wntShutdown

Shuts down (and optionally restarts) a computer..

Syntax:

wntShutdown( computer-name, message, timeout, force, reboot)

Parameters:

(s) computer-name: the name of an NT machine (eg, "FRED" or "\\FRED"), or a blank string ("") to indicate the local machine.

(s) message: a message to be displayed in the shutdown dialog box, or a blank string ("") if no message is desired.

(i) timeout: the amount of time, in seconds, that a shutdown dialog box should be displayed on the specified computer before the computer is shut down. While the dialog is displayed, a countdown timer shows the number of seconds remaining, and when it reaches 0 the computer is shut down. "timeout" can be set to 0, in which case no dialog is displayed and the computer is shut down immediately. Or "timeout" can be set to "-1", which tells the the function will attempt to abort a previously scheduled shutdown as long as the previous shutdown request's timeout period has not already expired.

(i) force: If "force" is @TRUE, then applications with unsaved data will be forcibly closed. If "force" is @FALSE, then the user will be prompted to close such applications, and if the user cancels (or doesn't respond) then the computer will not be shut down.

(i) reboot: If "reboot" is @TRUE, the computer will be automatically restarted after shutting down. If "reboot" is @FALSE, the system flushes all caches to disk, clears the screen, and displays a message indicating that it is safe to power down.

Returns:

(i) Always returns 1 on success, or an error.

 

Note: In order to shut down a remote computer, the caller must have the privilege "Force shutdown from a remote system" (SeRemoteShutdownPrivilege).

Example:
; Load Appropriate Extender
AddExtender('wwwnt34i.dll',0,'wwwnt64i.dll')

;Reboot the local machine wntShutdown( "", "", 0, @FALSE, @TRUE) Exit