You can get the latest 'Revert to snapshot' via Get-ViEvent.
How far you can go back depends on how long you keep events in your environment.
Update the Start parameter accordingly.
This gives the full list, to get this for a specific VM, add a Where-clause.
Get-Vievent -Start (Get-Date).AddDays(-7) -Maxsamples ([int]::MaxValue) |
Where-Object { $_ -is [VMware.Vim.EventEx] -and $_.EventTypeId -eq 'com.vmware.vc.vm.VmStateRevertedToSnapshot' } |
Group-Object -Property ObjectName -PipelineVariable vm |
ForEach-Object -Process {
$_.group | Sort-Object -Property CreatedTime -Descending |
Select -First 1 |
Select @{N='VM';E={$vm.Name}},
CreatedTime,
EventTypeId,
@{N='Snapshot';E={$_.Arguments.where({$_.Key -eq 'snapshotName'}).Value}}
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You can get the latest 'Revert to snapshot' via Get-ViEvent.
How far you can go back depends on how long you keep events in your environment.
Update the Start parameter accordingly.
This gives the full list, to get this for a specific VM, add a Where-clause.
Get-Vievent -Start (Get-Date).AddDays(-7) -Maxsamples ([int]::MaxValue) |
Where-Object { $_ -is [VMware.Vim.EventEx] -and $_.EventTypeId -eq 'com.vmware.vc.vm.VmStateRevertedToSnapshot' } |
Group-Object -Property ObjectName -PipelineVariable vm |
ForEach-Object -Process {
$_.group | Sort-Object -Property CreatedTime -Descending |
Select -First 1 |
Select @{N='VM';E={$vm.Name}},
CreatedTime,
EventTypeId,
@{N='Snapshot';E={$_.Arguments.where({$_.Key -eq 'snapshotName'}).Value}}
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi @LucD,
thanks for your quick response. I was afraid that it would be only via the events.