Have you ever wondered how or where the vSphere UI generates the default Virtual Machine hardware configuration after selecting a specific Guest OS during the VM creation wizard?
This is a topic I had written about back in 2013 here and here, which demonstrates how to use the EnvironmentBrowser API to query for the list of supported Guest OS and Virtual Hardware Compatibility. In addition to this information, we can also ask the vSphere platform on what are the default hardware configuration for all supported Guest OS using the QueryConfigOption API.
To demonstrate how to use the QueryConfigOption API, I have created two simple PowerCLI function which can be found in this example vmDefaultHardwareConfig.ps1
Before we can retrieve the VM hardware configuration for a specific Guest OS, we need to specify the supported VM hardware compatibility. To do this, you can use the Get-VMHardwareVersion function and specify the desired vSphere Cluster to query this information as shown in the screenshot below.
$ClusterName = "Supermicro-Cluster"
Get-VMHardwareVersion -ClusterName $ClusterName
Once we have the list of supported VM hardware compatibility versions, then we can use the Get-VMHardwareConfig function and specify the desired vSphere Cluster and the VM hardware compatibility version to retrieve the list of all Guest OS and their default hardware configurations.
$results = Get-VMHardwareConfig -ClusterName $ClusterName -VMHardwareVersion "vmx-19"