VMware Cloud Community
esxadmin76
Contributor
Contributor
Jump to solution

Get snapshot deleted date/time

I've browsed the forum and have gotten some great scripts to get vm information on snapshots created/reverted but I would also

like to know how I can see the Snapshots that have been deleted in the past x amount of days.

I see vim.vm.Snapshot.remove in the logs and thought something like the following would work:

Get-VIEvent -MaxSamples ([int]::MaxValue) -Start $start |

  where {($_ -is "VMware.Vim.EventEx" -and "vim.vm.Snapshot.remove" -eq $_.Info.DescriptionId)} |

Select CreatedTime,UserName,@{N="VM";E={$_.Vm.Name}},FullFormattedMessage

But it returns nothing. Any assistance would be greatly appreciated.

Thanks

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

You were nearly there, but you should look for a TaskEvent and the DescriptionId is slightly different.

Get-VIEvent -MaxSamples ([int]::MaxValue) -Start $start |
where {($_ -is "VMware.Vim.TaskEvent" -and "vm.Snapshot.remove" -eq $_.Info.DescriptionId)} |
Select CreatedTime,UserName,@{N="VM";E={$_.Vm.Name}},FullFormattedMessage


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
5 Replies
LucD
Leadership
Leadership
Jump to solution

You were nearly there, but you should look for a TaskEvent and the DescriptionId is slightly different.

Get-VIEvent -MaxSamples ([int]::MaxValue) -Start $start |
where {($_ -is "VMware.Vim.TaskEvent" -and "vm.Snapshot.remove" -eq $_.Info.DescriptionId)} |
Select CreatedTime,UserName,@{N="VM";E={$_.Vm.Name}},FullFormattedMessage


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
esxadmin76
Contributor
Contributor
Jump to solution

I did try it with "VMware.Vim.TaskEvent" but my DescriptionId was off.

Is there a place to find all of the info on getting DescriptionId's and what events can be searched for?

Thanks!

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Have a look at The Making of section in my HA VM failover tracking post.

It shows how to find the available events.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
vmCalgary
Enthusiast
Enthusiast
Jump to solution

@LucD 

 

Is this still valid syntax for reporting on deleted snapshots? I'd like to add who deleted the snapshot and what was the snapshot size.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

It should be, and the Username is in there.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference