VMware Cloud Community
JananiShyam
Contributor
Contributor

Listing Virtual Machines in the ESX Server

Are there any APIs to get the list of Virtual Machines under an ESX Server? How can we find all the details of the Virtual Machines and where the VMs are stored ie., if the VMs are in the SAN or any other storage device?

Reply
0 Kudos
7 Replies
Dave_Mishchenko
Immortal
Immortal

There are some resources here:

Reply
0 Kudos
wila
Immortal
Immortal

You should also be able to get this information using scripting in the console.

Here's an example from

http://www.xtravirt.com/index.php?option=com_content&task=view&id=64&Itemid=67

that is really simple:

vimsh -n -e "vmsvc/getallvms"

But you could also use the "vmware-cmd -l" approach to list all vm's on a particular host and process the output of that.

There's examples available on the net if you search a bit.

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
Reply
0 Kudos
JananiShyam
Contributor
Contributor

How do i get "vimsh" on my ESX Server? The documentation says its still being reviewed.

Reply
0 Kudos
Dave_Mishchenko
Immortal
Immortal

It comes as part of ESX 3.0.x and will already be installed.

Reply
0 Kudos
JananiShyam
Contributor
Contributor

Can all these scripts be run on the remote machines that are not configured as ESX Servers? I want to know if there are ways to get the list of VMs and their properties from a remote machine which has any flavour of windows installed.

Reply
0 Kudos
wila
Immortal
Immortal

Can all these scripts be run on the remote machines that are not configured as ESX Servers? I want to know if there are ways to get the list of VMs and their properties from a remote machine which has any flavour of windows installed.

You can run the scripts only ON the ESX server, but FROM any type of operating system that you like. As long as you can use a SSH client in order to access the console on the server. For windows that would probably be putty or its associate plink and using that you can run scripts like a bash-scripts or a perl scripts.

These scripts are great as they are easy to understand and maintain, even if you are not a software developer.

If that's not your cup of tea then your alternative is the SDKs that David pointed you towards. You'll have to master a software language capable of accessing the SDK in order to work with this.

This doesn't mean it is difficult, but it expects that you understand the programming paradigm used.

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
Reply
0 Kudos
JananiShyam
Contributor
Contributor

Using the SDK will i be able to access the ESX server to get the list of VMs and their properties? I am mainly concerned about the type of stirage device the VM is located in.

Reply
0 Kudos