List All SnapShots For All Volumes in VOL/Snapshot/Date format

by Frequent Contributor on ‎2010-06-10 11:17 AM

get-navol | foreach-object {$ParentName=$_.Name;get-nasnapshot $_.Name | add-member -membertype noteproperty -name ParentName -value $ParentName -passthru} | select ParentName
,Name,@{Name="AccessTime";Expression={[timezone]::CurrentTimeZone.ToLocalTime(([datetime]'1/1/1970').AddSeconds($_.AccessTime))}}

Displays:

ParentName                                                   Name                                                         AccessTime
----------                                                   ----                                                         ----------
vol0                                                         nightly.0                                                    6/9/2010 10:00:31 PM
vol0                                                         hourly.0                                                     6/9/2010 6:00:31 PM
vol0                                                         hourly.1                                                     6/9/2010 2:00:31 PM
vol0                                                         hourly.2                                                     6/9/2010 10:00:30 AM
vol0                                                         hourly.3                                                     6/9/2010 6:00:31 AM
vol0                                                         nightly.1                                                    6/8/2010 10:00:32 PM
vol0                                                         hourly.4                                                     6/8/2010 6:00:31 PM
vol0                                                         hourly.5                                                     6/8/2010 2:00:31 PM

I just add the property "ParentName" to each object output by get-nasnapshot, then add that property in my list of stuff to display with select.

Comments

Love it!

Occasionally our NDMP backups have problems because of problems with our backup servers. Sometimes they leave NDMP snapshots behind. This provides a quick and easy way to see all the snaphots

Thanks!

Great script. How would you change it so that it was just one line per volume showing volume name, volume size, total snapshot size, freespace, and maybe even de-dupe recovered space?

Warning!

This NetApp Community is public and open website that is indexed by search engines such as Google. Participation in the NetApp Community is voluntary. All content posted on the NetApp Community is publicly viewable and available. This includes the rich text editor which is not encrypted for https.

In accordance to our Code of Conduct and Community Terms of Use DO NOT post or attach the following:

  • Software files (compressed or uncompressed)
  • Files that require an End User License Agreement (EULA)
  • Confidential information
  • Personal data you do not want publicly available
  • Another’s personally identifiable information
  • Copyrighted materials without the permission of the copyright owner

Files and content that do not abide by the Community Terms of Use or Code of Conduct will be removed. Continued non-compliance may result in NetApp Community account restrictions or termination.