Problem remotely shutting down a windows computer with python

Tim G tim.golden at
Tue Jan 4 09:24:14 EST 2005

> I have a problem when using the python script found here:
> It is a script to remotely shutdown a windows computer.  When I use
> the computer shuts down, but doesn't power off like with a regular
> shutdown. It stays on the "Safe to power off" screen and I have to
> the power button to actually power off.  Anyone know why this happens
> with this script?  Thanks for any help.
> Eric

I see that others have answered the question
pretty completely, but just to add the obligatory
WMI solution:
[ assumes you're using the wmi module from ]


import wmi
c = wmi.WMI (computer="other_machine", privileges=["RemoteShutdown"])
os = c.Win32_OperatingSystem (Primary=1)[0]
os.Win32Shutdown (Flags=12)

The Flags=12 bit should shut down all the way.


More information about the Python-list mailing list