Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to automatically obtain a list or array of the VMs (mac address/name/resource pool) currently created on a vSphere server and use it in a python app. Can someone please suggest a good approach or solution to do this? I'm rather new to the vSphere platform. Thanks.

share|improve this question
up vote 4 down vote accepted

You should probably look at VMWare VIX API:

Unfortunately it doesn't have python support. I don't know if it would be possible to make python use the C support? You could use perl or Powershell

If it has to be python then there is pyvix:

I've never used it and don't know if it works.

share|improve this answer
+1 for introducing me to pyvix – Jed Daniels Jun 8 '10 at 18:41

I've recently released pysphere:

For your case in particular

from pysphere import *
server = VIServer()
server.connect("your.esx.or.vcenter.hostname", "user", "password")
vms = server.get_registered_vms()
vm = server.get_vm_by_path(vms[0])
print vm.get_property("mac_address")
print vm.get_property("ip_address")
print vm.get_property("name")
print vm.get_resource_pool_name()
share|improve this answer

Take a look at the pyVmomi project which is the official Python SDK for the VMware vSphere API that allows you to manage ESX, ESXi and vCenter.

Moreover, the pyvmomi-community-samples repository contains lot of examples.

share|improve this answer
2016, this is the preferred method. – TechZilla Feb 24 at 18:56

It's time that Python got vSphere/VMware bindings.

I've got an API started on top of suds. You might want to follow (or join) my project on BitBucket:

I'm new to Python but at the minimum it will show you how to use suds to talk to the web services SDK.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.