windows services
Elbert Lev
elbertlev at hotmail.com
Sun Oct 17 07:33:48 EDT 2004
Francis Lavoie <francisl at aei.ca> wrote in message news:<mailman.5046.1097941098.5135.python-list at python.org>...
> Is it possible to restart windows services? (remotely and locally)
>
> Because I have a little script that retreive the LastWaitTimeout key of
> the automatic update, delete that key if it out schedule for our
> production needs. But still the service need to be restarded if I want
> that key to be reset, when Win Update will resynchronize with the sus
> server for new update.
>
> Thankx
I assume that you have "Python for Win32 Extensions" installed and you
are running your script not on linux computer :). To cntrol servicea
(including pause, stop etc.) one should use
win32service.ControlService(scHandle, code ).
code = 1 (from c include:
#define SERVICE_CONTROL_STOP 0x00000001
)
then you call win32service.StartService(scHandle, args)
Local/remote is controlled by
OpenSCManager(machineName, dbName , desiredAccess )
machineName - does the trik!
Good luck!
More information about the Python-list
mailing list