Recently I had a colleague come to me with a request. They had a Nutanix Prism Central production environment with certain images loaded. The previous administrator failed to document where those images were stored and they could not be located. My colleague wanted to download the images from their production Prism Central so they could upload them to a new test environment. I have written a Python script that will make that quite easy.

As with other scripts I have posted, there are some caveats to go over. First, I wrote this on Linux with Python 3. I have tested it on Windows 10 with Ubuntu subsystem which had Python 3 installed, but not on Windows with just Python installed. On the Nutanix side, this was tested against PC & AOS v5.10.multiple. All APIs used are publicly available/documented APIs.

This script requires the “requests” module, which is standard in some distros. If it’s not, then use “pip3 install requests” to install it. Same with hurry.filesize. Make sure you “pip3 install hurry.filesize” not “pip3 install hurry”. See the import line for other modules you may need to install.

Now to the script:

As this is a REST API based script, there is no need to run this in a CVM. Run this from your workstation. Make sure you are in a directory that has enough storage to store the image you download. The script will show you the file sizes of your images. One thing I’d like to add is a progress bar.

Update: Added support for up to 50 images to be listed. If you need more try changing the length from 50 to what you need. Also accounted for images that do not report a file size.

Here’s a screenshot of the script being run: