Shutdown the computer
Syntax SHUTDOWN [logoff_option] [/m \\Computer] [options] logoff_options: /i Display the GUI (must be the first option) /l Log off. This cannot be used with /m or /d option /s Shutdown /r Shutdown and Restart /a Abort a system shutdown. (only during the time-out period) /p Turn off the local computer with no time-out or warning (only with /d) /h Hibernate the local computer (only with /f ) /e Document the reason for an unexpected shutdown of a computer Options:
/m \\Computer : A remote computer to shutdown. /t xxx : Time until system shutdown in seconds. The valid range is xxx=0-600 seconds. [default=30] /c "Msg" : An optional shutdown message [Max 127 chars] /f : Force running applications to close. This will not prompt for File-Save in any open applications. so will result in a loss of all unsaved data!!! /d u:xx:yy : List a USER (unplanned) reason code for the shutdown. /d P:xx:yy : List a PLANNED reason code for the shutdown. xx Specifies the major reason code (0-255) yy Specifies the minor reason code (0-65536) Options in bold are for Windows 2003 and later
When using this command to reboot a server, the shutdown process will normally allow 30 seconds to ensure each running service has time to stop. Services are shutdown in alphabetical order. The shutdown may be done made faster if the services are first halted in a specific order using NET STOP or SC.
E = Expected
U = Unexpected
P = Planned (C = customer defined)
Type Major Minor Title U 0 0 Other (Unplanned) E 0 0 Other (Unplanned) E P 0 0 Other (Planned) U 0 5 Other Failure: System Unresponsive E 1 1 Hardware: Maintenance (Unplanned) E P 1 1 Hardware: Maintenance (Planned) E 1 2 Hardware: Installation (Unplanned) E P 1 2 Hardware: Installation (Planned) P 2 3 Operating System: Upgrade (Planned) E 2 4 Operating System: Reconfiguration (Unplanned) E P 2 4 Operating System: Reconfiguration (Planned) P 2 16 Operating System: Service pack (Planned) 2 17 Operating System: Hot fix (Unplanned) P 2 17 Operating System: Hot fix (Planned) 2 18 Operating System: Security fix (Unplanned) P 2 18 Operating System: Security fix (Planned) E 4 1 Application: Maintenance (Unplanned) E P 4 1 Application: Maintenance (Planned) E P 4 2 Application: Installation (Planned) E 4 5 Application: Unresponsive E 4 6 Application: Unstable U 5 15 System Failure: Stop error E 5 19 Security issue U 5 19 Security issue E P 5 19 Security issue E 5 20 Loss of network connectivity (Unplanned) U 6 11 Power Failure: Cord Unplugged U 6 12 Power Failure: Environment P 7 0 Legacy API shutdown
Shutdown the local system immediately:
Restart the local system in 60 seconds time and specify the reason "Application: Installation (Planned)" :
SHUTDOWN /r /t 60 /d P:4:2
Restart the remote system server64 and specify the reason "Security Fix, Planned"
SHUTDOWN /r /m \\server64 /d P:2:17
“I shall go the way of the open sea, To the lands I knew before you came,
And the cool ocean breezes shall blow from me, The memory of your name” ~ Laurence Hope
LOGOFF - Log off a user.
BootCFG - Edit Boot.ini settings.
PsShutdown - SysInternals command line tool
TsShutDn - Terminal Services Shutdown
EVENTCREATE - Add a message to the Windows event log
PowerOff - Stefan Kuhr utility (NT / 2K)
$os = (Get-WmiObject Win32_OperatingSystem -ComputerName MyServer64)
$os.psbase.Scope.Options.EnablePrivileges = $true