InitiateSystemShutdown(computerName, message, timeOut, bForceClose, bRebootAfterShutdown)

Initiates a shutdown and optional restart of the specified computer.


computerName : string/PyUnicode

Specifies the name of the computer to shut-down, or None

message : string/PyUnicode

Message to display in a dialog box

timeOut : int

Specifies the time (in seconds) that the dialog box should be displayed. While this dialog box is displayed, the shutdown can be stopped by the AbortSystemShutdown function. If dwTimeout is zero, the computer shuts down without displaying the dialog box, and the shutdown cannot be stopped by AbortSystemShutdown.

bForceClose : int

Specifies whether applications with unsaved changes are to be forcibly closed. If this parameter is TRUE, such applications are closed. If this parameter is FALSE, a dialog box is displayed prompting the user to close the applications.

bRebootAfterShutdown : int

Specifies whether the computer is to restart immediately after shutting down. If this parameter is TRUE, the computer is to restart. If this parameter is FALSE, the system flushes all caches to disk, clears the screen, and displays a message indicating that it is safe to power down.

Win32 API References

Search for InitiateSystemShutdown at msdn, google or google groups.