VMware Cloud Community
tomerleib
Contributor
Contributor

Deleting snapshots from all VM

Hi,

I recently upgraded my vSphere 4.1 to 5.1 and used Update Manager to upgrade all VM to version9 and update the vmtools.

I choose to perform a snapshot of the VMs before the updates and also choose a time for the snapshots to be deleted.

Everything worked fine, but the snapshots were not removed.

When I go the the Snapshots manager, I can see that in the description it is stated that the snapshot will be deleted at 18/7 the day of the updates.

Since I have around 200 VMs, is there any way that I can remove all the snapshots from all the VMs instead of going one by one?

0 Kudos
2 Replies
julienvarela
Commander
Commander

Hi,

If you want delete all your snapshot you can do this:

Get-VM  | Get-Snapshot | Remove-Snapshot -confirm:$false -RunAsync


Regards,

Julien

Regards, J.Varela http://vthink.fr
0 Kudos
vFantastic
Enthusiast
Enthusiast

I would use the below to get a list of snaps in your environment first as there may be snaps you don't want to remove. The same filters can be applied to the above post to automate removal.

Replace the Quotes with any filters you may want to add to exclude certain snaps if you are using a snapshot based backup solution or VDI or other filters you may want to exclude.

Get-VM | Get-Snapshot | where {$_.Name.Contains("snapshot-") -ne "True" -and $_.Name.Contains("Veeam") -ne "True" -and $_.Name.Contains("vdm-initial-") -ne "True"} | select VM,Name,Description,Created,SizeMB | Export-Csv D:\SnapshotsFiltered.csv -NoTypeInformation -UseCulture

-vFantastic

0 Kudos