Automation

 View Only
  • 1.  check VMX file

    Posted Sep 06, 2010 06:57 AM

    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.



  • 2.  RE: check VMX file

    Posted Sep 06, 2010 09:33 AM

    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



  • 3.  RE: check VMX file

    Posted Sep 07, 2010 05:06 AM

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



  • 4.  RE: check VMX file

    Posted Sep 07, 2010 07:09 AM

    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