I am trying to start a service within the client virtual machine through pyVmomi. I couldn't find much in the official documentation on this, and I searched the net to no avail. I then modified the code I have used to successfully launch a silent MSI install, to simply run cmd.exe with the argument 'net start' plus the service name. That returns a valid process ID as if it has launched cmd, however the service doesn't start. I did wonder if it was permissions, however there is a specific error relating to permissions (or lack of) in the guest VM, and this isn't thrown. I don't get any errors at all. Any thoughts on how to start a service through pyVmomi?
def startService(ServiceName):
"""
starts a specified windows service [serviceName]
"""
pm = esxiContent.guestOperationsManager.processManager
ps = vim.vm.guest.ProcessManager.ProgramSpec(
programPath='cmd.exe', arguments='net start ' + ServiceName,
)
pid = pm.StartProgramInGuest(vm, creds, ps)
print(pid)