Query all snapshots from Nutanix-AHV

Introduction:
While working in a Nutanix-AHV environment I wanted to list all snapshots in the environment. With VMware vSphere you needed to do this with PowerCLI or use the excellent RVTools. In Nutanix Prism you can (to my knowledge) only see the snapshots when opening the virtual machine details.

Going through every VM in this environment would cost precious time that could also be spent drinking coffee, going through Twitter or catching up on some sleep. So I created the following script to list all snapshots in your environment, the virtual machine it belongs to and when it was created.

The script:

Just copy the code below to your PowerShell editor of choice (Visual Studio Code FTW) and save it as a .ps1 file or download the Zip file.

Fill in the NTNXCluster variable with the Fully Qualified Domain Name / Hostname or IP address of your Nutanix Cluster(s) (divide multiple with a semicolon (;)) and add any exceptions if needed. Also make sure you have the Nutanix Cmdlets installed on your system (which of course you have already).

After that run the .ps1 file and it will ask for credentials which it will use to connect to the Nutanix Cluster and retrieve the snapshot information.

The actual script:

DISCLAIMER: Once again: I’m in no way an expert PowerShell scripter, so it might not be the most efficient code, but it gets the job done. And, of course, feel free to use it/alter it/publish it as your own.

1,371 total views, 1 views today

Leave a Reply

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