Cloud Articles and Resources

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

fjohn

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.

Please Note:

All content posted on the NetApp Community is publicly searchable and viewable. Participation in the NetApp Community is voluntary.

In accordance with 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 (PII)
  • Copyrighted materials without the permission of the copyright owner

Continued non-compliance may result in NetApp Community account restrictions or termination.

Replies
jstuder01

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!

MOULSDALE

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?

All Community Forums
Public