PowerCLI: List all snapshots

It’s been a while since last update, again, so I figured I should at least provide something..

I recently started in a new job, and one of the first things I looked into was the amount of snapshots in our vmware environments. Not surprisingly there was a lot of snapshots, and very few of them had any hints of when they were taken and why.

The vsphere console doesn’t provide this info so I had to turn to PowerCLI to get the info I needed. PowerCLI is really just a snap-in to powershell so I felt right at home Smilie: :)

After you start PowerCLI, you need to first connect to your vcenter server:

Connect-VIServer <vcenter server>

You will be promted for username and password for vcenter. After powershell has connected to the vcenter server, all you need to is run this one-liner:

Get-VM | Get-Snapshot | Select VM,Name,@{N="SizeGB";E={@([math]::Round($_.SizeGB))}},Created

This will return a list of all vm’s, their snapshots, size of the snapshots and the date the snapshot was taken.

Category(s): PowerCLI, Powershell, VMware
Tags: , , , , , , ,

One Response in another blog/article

  1. […] about this same topic: listing snapshot info using PowerCLI. In my original post (which you can see here) I only wrote a pretty simple one-liner. Which was kind of okay, but it was missing one crucial […]

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.