VMware Cloud Community
vrm
Contributor
Contributor

Check the virtual hardware version

Hi All,

I need to find all virtual machines with virtual harware older than version 8. I need some PowerCli sample code. Can anyone give me some examples?

Cheers!

Vincent

0 Kudos
2 Replies
sneddo
Hot Shot
Hot Shot

Might be a cleaner way of doing this, but this should work:

Get-VM | Select Name, @{Name="HWVersion";  Expression={$_.Version.ToString().substring(1)}} | Where {$_.HWVersion -lt 8}

0 Kudos
Grzesiekk
Expert
Expert

$result = get-view -viewtype virtualmachine -property 'Config.Version','name'  | ? {[int]$_.Config.Version.SubString(4,2) -lt 8}  | select Name, @{n='vmx-version';e={$_.config.version}}

Then just run

$result

to see vms with version less than 8.

--- @blog https://grzegorzkulikowski.info
0 Kudos