Automation

 View Only
  • 1.  Script to determine who created a snapshot

    Posted Feb 12, 2014 03:42 PM

    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



  • 2.  RE: Script to determine who created a snapshot

    Posted Feb 12, 2014 04:35 PM

    Have a look at Alan's PowerCLI: SnapReminder



  • 3.  RE: Script to determine who created a snapshot

    Posted Feb 12, 2014 04:40 PM

    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



  • 4.  RE: Script to determine who created a snapshot
    Best Answer

    Posted Feb 12, 2014 06:08 PM

    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.



  • 5.  RE: Script to determine who created a snapshot

    Posted Feb 12, 2014 06:45 PM

    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.