It’s a bit tricky to find, but the API reference showed me where to look. And now I’m posting it here, so you don’t have to search any further.
First, connect to the Option Manager:
$SI = Get-View $ServiceInstance
$OM = Get-View $SI.Content.Setting
Query current values of advanced options:
$OM.QueryOptions(‘ADV_OPTION_NAME’)
To change or add an advanced option:
Create a new object to hold the new settings.
$newOption = New-Object VMware.Vim.OptionValue
Set the Key and Value you would like to add or change.
$newOption.Key = ‘ADV_OPTION_NAME’
$newOption.Value = 300
Use the UpdateOptions method to execute the change.
$OM.UpdateOptions($newOption)
Tadaa! :)
No related posts.

bubba
November 20th, 2008
Strange that I am trying to change vpxSetting:
$SI = Get-View ServiceInstance
$OM = Get-View $SI.Content.Setting
$OM.QueryOptions(“log.level”)
#$newOption = New-Object VMware.Vim.OptionValue
$newOption.Key = “log.level”
$newOption.Value = info
$OM.UpdateOptions($newOption)
But i get error:
PS C:\Program Files\VMware\Infrastructure\VIToolkitForWindows> .\queryAdvValue.ps1
Key Value DynamicType DynamicProperty
— —– ———– —————
log.level verbose
The term ‘info’ is not recognized as a cmdlet, function, operable program, or script file. Verify the term and try again.
At C:\Program Files\VMware\Infrastructure\VIToolkitForWindows\queryAdvValue.ps1:7 char:24
+ $newOption.Value = info <<<<
Exception calling “UpdateOptions” with “1″ argument(s): “A specified parameter was not correct.
”
At C:\Program Files\VMware\Infrastructure\VIToolkitForWindows\queryAdvValue.ps1:9 char:18
+ $OM.UpdateOptions( <<<< $newOption)
I am thinking maybe I incorrectly use UpdateOptions?
bubba
November 20th, 2008
Strange, I changed info with “info” and all of a sudden it started working…
Would you have some more example, but with API Ref, it would really help, thanks!
admin
November 20th, 2008
Bubba,
That has something to do with “expression mode” versus “command mode”. In this case, it is not able to guess that you meant to provide a string. It tried to find a commandlet or executable that matches the name info. To be safe, you can always use parenthesis. Or read more about parsing modes here: http://keithhill.spaces.live.com/Blog/cns!5A8D2641E0963A97!6058.entry
bjorn bats
June 22nd, 2009
hugo,
is it also possible to set advanced settings of a virtual machine ?
this would be really handy, i cannot find it