how to check which vms have snapshots in a very dirty but quick way?


I have written more advanced scripts for printing, reporting stuff about snapshots than this one, but here it is just about to see which vm has snapshot. That is all i want by running this command. And i want to see the results FAST!, i mean NOW!, or like YESTERDAY! 😉

Get-View -ViewType VirtualMachine -Filter @{"snapshot" = ""} | select name

bam!
That’s it ;], nothing more. It will just output the vSphere .net view object for vms that have snapshots on it. Once again, it is not fancy, it does not send e-mail, it does not do coffee while running, it just shows you vms with snapshots on it. You can build your own “EXTRA” around this if you want. I just wanted to see very quickly if i have snaps or not. If you have any better idea / quicker how to view snapshots on vm, please post a comment!

Advertisements

2 thoughts on “how to check which vms have snapshots in a very dirty but quick way?

  1. Hi there!
    This is a really old post but I just wanted to respond to your question if there is a better/quicker way to get the list. There is.
    By only retrieving the properties you case (in this case Name) you can cut the execution time significantly.

    Check it out:
    Measure-Command {
    Get-View -ViewType VirtualMachine -Filter @{“snapshot” = “”} | Select Name
    }
    # 960 milliseconds on a system with 500 VM and 116 snapshots.

    Measure-Command {
    Get-View -ViewType VirtualMachine -Filter @{“snapshot” = “”} -Property Name | Select name
    }
    # 96 milliseconds on the same system (e.g. 1/10 of the execution time). That is an improvement…

    • Hi Bob, yep, of course that will be faster 😉 This is quite an old post. I already wrote a post with how to use get-view with -property. Still, thanks for noticing!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s