[python-win32] Reboot apis don't work in a NT service
le.dahut at laposte.net
Thu Mar 20 11:01:34 CET 2008
I use a service tu update another. It download an InnoSetup file, launch
it with /silent and restart the computer at the end of the process.
To reboot the computer I've tried this different functions :
win32api.ExitWindowsEx(EWX_REBOOT | EWX_FORCE)
win32api.InitiateSystemShutdown(None, '', 0, True, 1)
wa.WinExec('shutdown -r -t 0 -f')
I've correctly setup 'SeShutdownPrivilege' before calling them.
The "bForceAppsClosed" is set to True
Since I noticed that they didn't reboot the computer but raised an
error, I've put them in a loop :
except Exception, e:
This permits to reboot the workstation after several minutes (between 3
and 9 minutes).
I there a way to reboot a workstation while nobody has loged on ?
More information about the python-win32