In our staging environment we're going to test automation to upgrade to the new builds. I regularly need to make sure the VMs are running with a snapshot taken at the same time (via PowerCLI, we use the same description).
In other words, is there a way to retrieve the current active snapshot name for all VMs?
Using:
get-resourcepool "MyResPool" | get-vm | get-snapshot | select @{Name="VM Name"; Expression={$_.VM.Name}}, created, name, description | Sort-Object created | Format-Table -auto
doesn't highlight which one is active.
The IsCurrent property of a snapshot tells you if a snapshot is current. I modified your script to only show the active snapshots:
Get-ResourcePool "MyResPool" | ` Get-VM | ` Get-Snapshot | ` Where-Object {$_.IsCurrent} | ` Select @{Name="VM Name";Expression={$_.VM.Name}},Created,Name,Description | ` Sort-Object -Property Created | ` Format-Table -AutoSize
Regards, Robert
Check out this link:
http://blog.axiomdynamics.com/2010/03/powercli-script-for-snapshot-reporting.html
Best Regards
The IsCurrent property of a snapshot tells you if a snapshot is current. I modified your script to only show the active snapshots:
Get-ResourcePool "MyResPool" | ` Get-VM | ` Get-Snapshot | ` Where-Object {$_.IsCurrent} | ` Select @{Name="VM Name";Expression={$_.VM.Name}},Created,Name,Description | ` Sort-Object -Property Created | ` Format-Table -AutoSize
Regards, Robert
Thank you Robert, this is exactly what I was looking for.