Skip to content
/ lsvm Public

A small program to list virtual machines from cli on vSphere

Notifications You must be signed in to change notification settings

thebsdbox/lsvm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

lsvm

A small program to list virtual machines from cli on vSphere

** PLEASE NOTE: whilst this only reads from a number of files, it's not really production ready

This program has the some functionality as the command line:

# vim-cmd vmsvc/getallvms

However in another project I didn't want to rely on having to spawn external commands so developed a rather convoluted method for finding registered virtual machines. This program will read through the vmInventory.xml file, this uses libxml2 (which luckily is part of vSphere) and returns the full paths to the .vmx files that make up the virtual machines. It will then parse those files and return the virtual machine name, which is specified with the Key "DisplayName".

To compile use the following line:

gcc -Wall -o lsvm -std=c99 $(xml2-config --cflags) $(xml2-config --libs) lsvm.c

About

A small program to list virtual machines from cli on vSphere

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages