Hello,

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)
win32ts.WTSShutdownSystem(wts.WTS_CURRENT_SERVER_HANDLE, wts.WTS_WSD_REBOOT)
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 :
while True:
   try:
     wa.ExitWindowsEx(...)
     break
   except Exception, e:
     logging.error('%s'%e)
     time.sleep(0.5)

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 ?


_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to