PowerCLI: Function for listing snapshots
My very first PowerCLI related post was 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 thing: who took the snapshot? Why vmware hasn’t found a way to include a username in the get-snapshot cmdlet is something I just can’t understand. There’s really not much code needed to add this to the output, and there’s several ways of doing so. I found that using Get-Snapshot and Get-VIEvent together was the easiest way to get all the info I want. It’s not a perfect solution, seeing as I really wanted to make use of the much faster Get-View instead of Get-Snapshot, but I have yet to figure out a good way to handle snapshot trees using Get-View. As usual I created a function for…
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 🙂 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…