VMware Cloud Community
kevinjj
Contributor
Contributor

check VMX file

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.

0 Kudos
3 Replies
LucD
Leadership
Leadership

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

0 Kudos
kevinjj
Contributor
Contributor

Did you mean if the key is not there it will output nothing?

0 Kudos
LucD
Leadership
Leadership

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

0 Kudos