A few moments ago I saw a blog post from Ben Armstrong (Microsoft) about using PowerShell to list all snapshots from a virtual machine.
That script will ask you which VM to look at, and will output a list of snapshots that belong to this VM.
That got me thinking… Most of the times, I don’t want to know this information about “just” one VM… I want to know it from all VM’s! Preferably including the tree of snapshots…
And here comes PowerShell again, with a simple one-liner:
Get-VM | Get-VMsnapshotTree | Select VM,Name,Description,Created
I found this to be especially useful in large environments where departments are allowed to manage their own virtual machines, for example developers. When snapshots are created but never removed when they are no longer needed, this will give you a simple output which allows you to contact the appropriate persons
Did Get-VMsnapshotTree disappear with 2008 R2? I cant find it in 2012 R2.
Anyway, if you want to add a condition to only list checkpoints older than a certain # of days you can do this, and also point to the cluster to get all the nodes:
Get-VM -ComputerName (Get-ClusterNode -Cluster hpvclu.domain.com) | Get-VMSnapshot | Where-Object {$_.CreationTime -lt (Get-Date).AddDays(-2) } | Select VMName,Name,SnapshotType,CreationTime,ComputerName