Get Virtual Machines with active Snapshots using Powershell

Snapshots play a vital role when a change has to be occurred and it acts like an undo button, when the results are not as your expectations. On the other hand, this shiny button can also be a bit dangerous, as you allow the machine to use more than the capacity it’s been given, which might result in bad conditions. Anyway to get the list of VMs with snapshots and their size you can use PowerCLI.

with Get-Snapshot cmdlet, you can get a list of all snapshots, but when running you don’t actually know on what VMs these snapshots are residing.

To do so, you need to use Format List to see all the attributes of snapshot object. we are looking at one of those for instance:

as you see there are various attributes including VM and Size which you can have it as an output using Select-Object cmdlet, which you can have a customized list of your own appetite.

Get-VM | Get-Snapshot | Select-Object VM, Name, Created, SizeGB

Run Powershell and enjoy it.

Leave a Reply

Your email address will not be published.