Hi,
I'm trying to make a scrip that will automatically reconfigure certain services like imagebuilder and auto-deploy to automatic startup using powercli.
I saw wlam's post about how to get status of VAMI services and start/stop them (https://www.virtuallyghetto.com/2017/02/exploring-new-vcsa-vami-api-wpowercli-part-8.html)
However it doesn't show how to update the service.
I took a look at the API - update command or patch as I've seen it in the vSphere client API explorer.
However I am unable/don't know how to write a "com.vmware.appliance.vmon.service.update_spec" object to pass onto the update method.
The code I have sofar is this, just missing the critical piece that actually manages to set the startup type of the service.
Connect-CisServer -Server $vce -Credential $credential
$vMonAPI = Get-CisService 'com.vmware.appliance.vmon.service'
$update_spec = @{
spec= @{
startup_type="MANUAL"
}
}
$vMonAPI.update('rbd',$update_spec)
$vMonAPI.Get('rbd')
Any ideas what I am doing wrong?
Thanks,
Ionut
I have also been wondering how to accomplish this specific service change.
Your spec can be a bit simplified like this :
$update_spec = @{
startup_type="AUTOMATIC"
}
after that use this modified command to actually update the startup type :
$vMonAPI.update('rbd',$update_spec)
it did not work because in your previous spec you had to modify your command to this (because there is a table in table here) :
$vMonAPI.update('rbd',$update_spec.spec)
This should fix your problem
Moderator: Moved to PowerCLI