[python-win32] Using win32serviceutil.InstallService() on a non admin account

Denis dhovart at gmail.com
Sat Jun 19 01:20:40 CEST 2010


Erm. Forget everything I wrote.
The error messages were actually pretty clear. I was experimenting with an
account on which I just can't install anything *at all*. There's no problem
with win32util.InstallService(), that was just me being stupid.
So excuse the useless noise :-)

On Sat, Jun 19, 2010 at 12:52 AM, Denis <dhovart at gmail.com> wrote:

> After some searches I've found a possible way to accomplish what I want
> using two executables provided as part of the Microsotf 2003 Resource Kits,
> namely Instsrv and Srvany (heck, windows utilities have wonderful names).
>
> Here is a tutorial to setup Trac as standalone using them :
> http://trac.edgewall.org/wiki/TracOnWindowsStandalone
> I could include them in my installer to make it follow the same procedure.
>
> I'm going to try this approach - just tell me if there's an other and more
> adapted way to proceed : windows development is unkown territory to me.
>
> Thanks in advance,
>
> Denis.
>
>
> On Fri, Jun 18, 2010 at 7:05 PM, Denis Hovart <dhovart at gmail.com> wrote:
>
>> Hi,
>> I'm creating an application that needs to run CherryPy as a background
>> service.
>> It currently works fine in Linux and Mac OS X, but I'm a bit struggling to
>> make the windows version as I'm new to win development.
>>
>> My code is a barely modified version of what can be found here :
>> http://tools.cherrypy.org/wiki/WindowsService
>> I've compiled it using py2exe and can run it without any problem logged as
>> an administrator.
>> The thing is that when I try to install the service on a default user
>> account, I get an error 5 — "Access is denied" from OpenSCManager.
>>
>> C:\cherrypy_service\cherrypy_service.exe -install
>> Traceback (most recent call last):
>>     File "boot_service.py", line 158 in <module>
>>     File "win32serviceutil.pyo", line 156, in InstallService
>> pywintypes.error: (5, ’OpenSCManager’, ’Access is denied.’)
>>
>> I've tried to install it with "sc create cherryPyService
>> binPath=C:\cherrypy_service\cherrypy_service.exe", even with specifying the
>> username and password, but the result is the same :
>>
>> [SC] OpenSCManager FAILED 5:
>> Access is denied.
>>
>> What is the correct way to install a service for a non-admin account on
>> windows ?
>>
>> Since I'd also like to create an installer for my app (I need to append a
>> new entry in the %SystemRoot%\system32\drivers\etc\hosts file), I guess that
>> I could install my service in the same time using admin privileges. Would
>> that be possible ? What tool would you recommand for this ?
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20100619/767c7255/attachment.html>


More information about the python-win32 mailing list