VMware Cloud Community
Ayan1
Contributor
Contributor

VM Snapshot Deletion script

I am new with Power cli.. created below script to delete VM snapshot for particular VMs mentioned in a CSV file.

​$date = get-date -format "yyyyMMdd_HHmmss"

Import-Csv C:\Output\PatchingVMsList.csv | %{Get-VM $_.Name} | Get-Snapshot -Name BeforePatching  | Remove-Snapshot -Confirm:$false -RunAsync

| Export-CSV C:\output\SnapshotRemoval-$date.csv -NoTypeInformation

​But the script will show only task name and status. I need to generate a report with below details:

VM Name

​Snapshot Name

​Deletion start time

​Deletion end time

​User Id use to delete the snap

Anyone help me on this?

Tags (1)
Reply
0 Kudos
1 Reply
flynmooney
Enthusiast
Enthusiast

I don't have anything with all of that but this post may be useful to you.  http://www.virtu-al.net/featured-scripts/snapreminder/