I want to get current value of "isolation.tools.setInfo.disable" in VMX file for many VMs. Is there a way to script it? Thanks.
If the key is present in the VMX file, you can get it like this
foreach($vm in Get-VM){ $vm.ExtensionData.Config.ExtraConfig | where{$_.Key -eq "isolation.tools.setinfo.disable"} | ` Select @{N="Name";E={$vm.Name}},@{N="Value";E={$_.Value}} }
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Did you mean if the key is not there it will output nothing?
That is correct, but the script can be adapted to for example display "na" when the key is not present.
Get-VM | %{ $option = $_.ExtensionData.Config.ExtraConfig | where{$_.Key -eq "isolation.tools.setinfo.disable"} $_ | Select @{N="Name";E={$_.Name}},@{N="Value";E={if($option){$option.Value}else{"na"}}} }
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference