4

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

user3184086
  • 621
  • 1
  • 8
  • 16
  • 2
    this is not a python specific issue. It is a general windows issue. Please google "windows start service without admin rights". One link from SO is http://stackoverflow.com/questions/4436558/start-stop-a-windows-service-from-a-non-administrator-user-account – Kinjal Dixit Feb 06 '14 at 05:00

0 Answers0