List all VMware snapshots on all Virtual Machines

I was on the phone with VMware the other day and asked if there was some way to get a list of all the snapshots I have across all of my virtual machines. The VMware rep said no, you have to click on each VM one by one. However, I figured that it could be done. Here’s how I did it.
Update: more concise output

Install vSphere PowerCLI if you don’t already have it. This is a PowerShell module for managing VMware, and it’s awesome.

connect vi-server myvirtualcenterserver

get-vm | % { write-host “$($.name): $(Get-Snapshot $.name)” }

You should get a list like:

myvirtualmachine: snapshotname

Note: This script will return a list of all servers, regardless if they have a snapshot. I didn’t care to filter out servers without snapshots, but it could be modified quite easily.

Now you want to remove unneeded snapshots, don’t you? I’m glad you asked!

myvirtualmachine” | % { get-vm -Name $_ } | % { Get-Snapshot -VM $_ } | % { Remove-Snapshot -Snapshot $_ }

This will confirm that you want to delete (each) snapshot on myvirtualmachine.

Update**:** This will show you just the machines with snapshots (and the snapshot names).

get-vm | % { Get-Snapshot $_ } | select -Property vm, name