I'm having quite an hard time trying to start a windows service from python using:
win32serviceutil.StartService("service-name")
It always returns:
File "C:\Python27\lib\site-packages\win32\lib\win32serviceutil.py", line 412, in StartService
hscm = win32service.OpenSCManager(machine,None,win32service.SC_MANAGER_ALL_ACCESS)
error: (5, 'OpenSCManager', 'Access is denied.')
I've read that to start a windows service the user must have administration rights. My username is not the hidden administrator account but I can perform administration tasks on my computer. So my question is, what is the best way to allow python to start a given service? I also know that disabling User Account Control I can start the service but this would reduce a lot the security of the machine. Isn't there a way to change the permissions of a service or grant administration rights to python to start services (or even better...just that service)?
Many thanks