A common question that I see asked on the VMTN community forums is the ability to programmatically identify which guest OSes (Operating Systems) are supported in vSphere using the vSphere APIs. This request usually comes in handy for folks looking to build their own custom provisioning solution or portal to provide to their end users.

Similar to the way the vSphere Web Client / C# Client provides a list of supported guestOSes and recommended configurations and maximums, you can also generate this list dynamically using the vSphere API.

This functionality is exposed in what’s called the Environmental Browser which provides the list of supported Virtual Machine configurations, device targets and capabilities for a given ESXi host. Within the Environmental Browser, there is a method called QueryConfigOption() that accepts an ESXi host as input to determine the capabilities and returns back a VirtualMachineConfigOption object. In this object, there are various properties and the one we are interested in is called guestOSDescriptor which provides a list of all the supported guestOSes including the supported virtual hardware and configuration maximums for each OS type.

Even though it is possible to retrieve the list of guest OSes, this is not the exhaustive nor the definitive list as it does not cover minor OS releases or OSes that may have been added recently to the support matrix. For the official list, you should still refer to VCG (VMware Compatibility Guide) website for the complete list of supported guest OSes for a particular version of vSphere.

Disclaimer: These script are provided for informational/educational purposes only.  It should be thoroughly tested before attempting to use in a   production  environment.

To demonstrate the QueryConfigOption method, I have created a simple vSphere SDK for Perl script called which lists all supported guestOSes given a vSphere Cluster as input.

Here is the syntax for the script:

Here is a screenshot of the output from the script;

The output above contains both the guestOS identifier as well as the guestOS full name and this is just a subset of the various properties that can be retrieved for each guestOS. You can also see the list of guestOS identifiers and their respective guestOS full name in the vSphere API Reference guide here. By leveraging this API, you can now dynamically generate and the list of supported guestOSes during provisioning and you no longer have to hard code a static list of guestOSes and their identifiers for provisioning.

Get notification of new blog postings and more by following lamw on Twitter:  @lamw

About the Author

William Lam

William Lam works as a Staff Engineer in VMware R&D and focuses Automation, Integration and Operations. William also runs a personal blog at Previous to VMware, he was a Systems Engineer managing large vSphere installations and UNIX/Linux systems.