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
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}
$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.