VMware Cloud Community
aryan14in
Enthusiast
Enthusiast

Pull VM information from ESXi

Hello,

I am planning to deploy Test VMs on ESXi. Because of high number of Test servers I would need them to spread across multiple ESXi servers. I don't want to licence for Vcenter. The problem without vcenter is it would be difficult to know which VM is on which ESXi host. Is there a command which i run periodically to get VM names/status (like we get in vcenter) from ESXi so that i could save that information to shared drive.

0 Kudos
2 Replies
lamw
Community Manager
Community Manager

Yes, there's a few ways actually, depending how you would like to view the data and how much detail.

If you just want to list VMs residing on a particular VM, you can use vmware-cmd with the vCLI

(e.g.)

vmware-cmd --server <server> --list

There's also other canned VMware scripts to provide a little bit more detail such as vminfo.pl using vSphere SDK for Perl which is installed by default with vCLI

Remember to note, that if you're using the FREE version of ESXi, querying for information using any of the toolkits will work but if you're trying to perform any operations via the CLI, such as adding a VM or change network, it will not work as you need to be using paid licensed.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

Twitter: @lamw

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos
PaulSvirin
Expert
Expert

Yes, here is a maodified code fragment posted by harryc:

#!/bin/sh
#
# /root/list-vms
#
# Purpose : list the vms registered on the ESX host and displays their status
#
# 2009-03-10 Harry C started
for VM in `vmware-cmd -l --server &lt;server&gt; `

do
echo $VM

&lt;vminfo.pl for $VM&gt;
done

---

iSCSI SAN software

--- iSCSI SAN software http://www.starwindsoftware.com
0 Kudos