Microsoft Virtualization Discussions

Get Snapshots

martin_fisher
5,017 Views

Just a quick query, but I suspect I already know the answer and just need to put it together.

Is there a way to quickly export a list of the snapshots, per volume?.

This can be done on a vol by vol basis no problems, but if you have hundreds to look at, no one wishes to repeat the task lots of times..

ie: get-navol vol0 | get-nasnapshot - the console will output a list of snaps for vol0.

If you run: get-navol | get-snapshot, the console will output a snapshot list for each and every volume, but the output is kind of useless as you have no way of identifying hundreds of snapshots and the relevant parent volume, as the output is one continous list..

Just wondered if I was missing a switch or command to get the correct output?

Thanks

2 REPLIES 2

egrigson1
5,017 Views

There are examples of how to do this in the forum, but I've attached a script which can query multiple filers and sends an HTML report via email (with snapshots per volume, as you're requesting). You can either use it 'as is' or cannibalise the code to do exactly what you need. Hope this helps,

Regards,

Ed.

cknight
5,017 Views

Hi, Martin.  The snapshot structure from Data ONTAP doesn't include the parent snapshot info, which is a known pain point and prevents effective use of snapshot objects in the PowerShell pipeline.  The forthcoming Toolkit 1.4 adds this information and should address your concern.


PS C:\> Get-NaSnapshot vol0 hourly.* | select Name, TargetName, TargetType | ft -AutoSize


Name     TargetName TargetType
----     ---------- ----------
hourly.0 vol0       volume
hourly.1 vol0       volume


PS C:\> Get-NaSnapshot vol0 hourly.* | Remove-NaSnapshot

Delete snapshot
Are you sure you want to delete snapshot hourly.0 from volume vol0?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): a
PS C:\>

Public