InitiateSystemShutdown( )


Initiates a shutdown and optional restart of the specified computer.

InitiateSystemShutdown(machineName, message, timeout, bForceAppsClosed, bReboot)



The network name of the machine to shut down or None for the current machine.


A string that specifies a message to be displayed in the shut-down dialog box or None for no message.


An integer that specifies the time in milliseconds to display the dialog. During this period, the shutdown can be aborted by calling AbortSystem-Shutdown(). If this value is zero, no dialog is shown, and the shutdown begins immediately.


An integer that specifies if applications should be forced closed. If true, users aren’t given an opportunity to save their work.


An integer that specifies if the machine should be restarted after shutdown or left in a state safe to power off the computer.


To shut down the local computer, the calling process must have the SE_SHUTDOWN_NAME privilege. To shut down a remote computer, the calling process must have the SE_REMOTE_SHUTDOWN_NAME privilege on the remote computer.

Get Python Programming On Win32 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.