Highlighted
Contributor
Contributor

How to get a list of all supported virtual hardware versions via powerCLI?

Jump to solution

Hey All,

is there a way to get a list of all supported/available (or only the latest) virtual hardware version via powercli?

enviroment: vSphere 6.7U3

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
Highlighted
User Moderator
User Moderator

Afaik that is not available programmatically, only through the VMware provided tables as for example in KB2007240


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

4 Replies
Highlighted
User Moderator
User Moderator

Afaik that is not available programmatically, only through the VMware provided tables as for example in KB2007240


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Highlighted
Contributor
Contributor

thanks LucD

😞 not nice.

I tried something like the way to get all available guestOS ID's [VMware.Vim.VirtualMachineGuestOSIdentifier].GetEnumValues() but no luck.....

The problem is that the CMD New-VM without the HardwareVersion option creates the vm with hardwareversion vmx-14 not vmx-15. But the CMD Doc's say "...By default, the new virtual machine is created with the highest available version..."

So i had the idea to first get the current hardwareversion and do a "autofill" for that parameter.... But how does the CMD New-VM get's the current HardwareVersion?

I'm using PowershellCore 6.2.3 and VMwareCLI-11.5.0-14912921

0 Kudos
Highlighted
User Moderator
User Moderator

Vmx-15 only adds the ability to configure a VM with 256 vCPU instead of 128 vCPU in vmx-14.
And yes, the default HW version for new VMs (in vSphere 6.7 Update 2 and higher) is still vmx-14.

That is a 'known feature' I'm afraid.

You can easily change the default HW version on the datacenter or cluster.
But remember, vmx-15 is only available since vSphere 6.7 Update 2.

$spec = New-Object VMware.Vim.DatacenterConfigSpec

$spec.DefaultHardwareVersionKey = 'vmx-15'

$modify = $true


$dc = Get-Datacenter -Name MyDC

$dc.ExtensionData.ReconfigureDatacenter_Task($spec, $modify)


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Highlighted
Enthusiast
Enthusiast

Thanks to the information provided by LucD I could write a piece of code which does the job.

function Get-VMHostVHardwareCapability {


    param(

        [Parameter(

            Mandatory,

            ValueFromPipeline

        )]

        [VMware.VimAutomation.ViCore.Impl.V1.Inventory.InventoryItemImpl]$VMHost

    )


    process {

        foreach ($VMHostItem in $VMHost) {

            [PSCustomObject]@{

                Name = $VMHostItem.Name

                VHardwareCapability = switch ([int]$VMHostItem.ExtensionData.Config.Product.Build) {

                    #Release numbers can be found here: https://kb.vmware.com/s/article/2143832

                    #Hardware versions can be found here: https://kb.vmware.com/s/article/2007240


                    #ESXi 7.0

                    { $PSItem -ge 15843807 } { 'vmx-17' }


                    #ESXi 6.7 U2

                    { $PSItem -ge 13006603 -and $PSItem -lt 15843807 } { 'vmx-15' }


                    #ESXi 6.7

                    { $PSItem -ge 8169922 -and $PSItem -lt 13006603 } { 'vmx-14' }


                    #ESXi 6.5

                    { $PSItem -ge 4564106 -and $PSItem -lt 8169922 } { 'vmx-13' }


                    #ESXi 6.0

                    { $PSItem -ge 2494585 -and $PSItem -lt 4564106 } { 'vmx-11' }


                    #ESXi 5.5

                    { $PSItem -ge 1331820 -and $PSItem -lt 2494585 } { 'vmx-10' }


                    #ESXi 5.1

                    { $PSItem -ge 799733 -and $PSItem -lt 1331820 } { 'vmx-9' }


                    #ESXi 5.0

                    { $PSItem -ge 469512 -and $PSItem -lt 799733 } { 'vmx-8' }


                    #ESXi/ESX 4.x

                    { $PSItem -ge 164009 -and $PSItem -lt 469512 } { 'vmx-7' }

                    Default { 'Unknow ESXi version' }

                }

            }

        }

    }

}


Get-VMHost | Get-VMHostVHardwareCapability

0 Kudos