Hello All
I have the following script, I need help in adding code to determine who created the snapshot.
Get-VM | Get-Snapshot | Where { $_.Created -lt (Get-Date).AddDays(-2)} | select VM, Name, Created, SizeMB
Have a look at Alan's PowerCLI: SnapReminder
I tried adding the Get-SnapshoCreator but its not working. I do not need to send an email, I just need to know who created it
try this,
get-vm | get-vievent | where-object {$_.fullformattedmessage -like "*snapshot*"} | Select-object @{N="VM"; E={$_.vm.name}}, username, FullFormattedMessage, CreatedTime
It will report snapshot deletion event as well.
The previous solution provides an incomplete report, since it doesn't link the snapshot to the user.
Try the attached script, it is based on my Get-VIEventPlus function, and it is a simplified version of my Get-SnapshotExtra function in Alan's script.