Welcome to part 2 of the “HowTo List Virtual Machines using Python and CIM“. In this part, I modified the original script so that you can pass the Virtual Machine name as well as run it with out the Virtual Machine name. In the first part of this HowTO I created the listVMsInfo.py script witch just listed all the Virtual Machines. So please enjoy the script and hopefully it will make your life just a bit easier.
python listVMsInfo.py -u "http://esxhost" -a "login passwd" -n "testVM" VM Name testVM Operating System Suse Linux Enterprise Server 10 (32-bit) Host Name None IP Address None DataStore Used [Esxtestvol] testVM.vmxRequested State Not ApplicableOperational Status Enabled Enabled by Default Enabled Enabled State Not Applicable
Download this script here!
Download