In this example I configure some advanced setting on an ESXi host. Syslog server is just one of the.
First I create a for loop to create my hostSetting array objects. Then late I fill them. Always the key and a value. You can check the ESXi host advanced setting in GUI for parameters. You need to watch the type. For instance the port for the syslog server is of type value_IntValue. There are also float and long. I have to say I don’t know why it say deprecated for value. Maybe I have to come back on that.
http://www.vmware.com/support/orchestrator/doc/vco_vsphere41_api/index.html
//myhost is input parameter of type VcHostSystem var hostSetting = new Array(); for (i=0; i<=3; i++) { hostSetting[i] = new VcOptionValue(); } hostSetting[0].key = "Syslog.Remote.Hostname"; hostSetting[0].value = "mysyslog.bigbluemike.com"; hostSetting[1].key = "Syslog.Remote.Port"; hostSetting[1].value_IntValue = 514; hostSetting[2].key = "Config.Defaults.security.host.ruissl"; hostSetting[2].value = true; hostSetting[3].key = "Annotations.WelcomeMessage"; hostSetting[3].value = "Welcome to this nice an shiny ESXi host."; host.configManager.advancedOption.updateOptions(hostSetting);
Thanks a lot for that simple snippit!
Helped me a lot of getting started with my script for some advanced settings.
Still up to date with ESXi 5.5 and 6.0.
Best way to find out the variable typ in the current versions is the MOB browser of the ESXi/vCenter.
I am glad this is still help to some. Maybe I should start again to post some more snippits. Something you need? The MOB browser is a good advice.