There are times you (System Administrator) may want to reboot your PC due to undesired behavior on your PC. During and after the installation of new programs (software and hardware), most times, you may need to restart your device. This will shut off all processes so that the Kernal can be re-established with the new software or hardware. Here I will be discussing day-to-day vital Microsoft Commands needed to operate and administer any Windows Environment ranging from Windows Server, 2008, 2012, 2016, and 2019. Kindly refer to these related guides: How to logoff, restart, or shutdown Windows PC or Server remotely via Command Prompt and PowerShell, how to restore a VM to its previous state (restoring a checkpoint), Unable to Shutdown a HyperV Virtual Machine, and how to use command prompt to shutdown and restart your computer.
Here are some switches associated with Windows regardless of the environment. I will be discussing a few.
The shutdown command allows you to shut down your PC or Server as the name implies. This will ensure windows initiates the shutdown of the server and the same process is followed as shutting down via the UI. The Switches below can be used with the shutdown command.
Syntax Usage: shutdown [/i | /l | /s | /r | /g | /a | /p | /h | /e | /o] [/hybrid] [/f] [/m computer][/t xxx][/d]
Let’s explain what these switches are in detail. Note, some systems can let us use (-) switches or (/). This depends on the version of your system.
|/i||Display the graphical user interface (GUI).|
This switch must be the first option.
|/l||Log off. Note: The /l switch cannot be used with /m or /d options.|
|/s||Shutdown the computer.|
|/r||Full shutdown and restart the computer.|
|/g||Full shutdown and restart the computer.|
|/a||Abort a system shutdown. But can only be used during the time-out period.|
|/p||Turn off the local computer with no time-out or warning. Can be used with /d and /f options.|
|/h||Hibernate the local computer. Can be used with the /f option.|
|/hybrid||Performs a shutdown of the computer and prepares it for fast startup.|
Must be used with /s option.
|/e||Document the reason for an unexpected shutdown of a computer.|
|/o||Go to the advanced boot options menu and restart the computer.|
Must be used with /r option.
|/m computer||Specify the target computer.|
|/t xxx||Set the time-out period before shutdown to xxx seconds. The valid range is 0-315360000 (10 years),|
|/c||Comment the reason for the restart or shutdown.|
|/f||Force running applications to close without forewarning users. The /f parameter is implied when a value greater than 0 is specified for the /t parameter.|
|/d||Provide the reason for the restart or shutdown.|
Here are some examples of how these syntaxes are used.
shutdown /r /c "Rebooting for after windows updates."
This command displays a Windows system shutdown window about 30 seconds prompting the user that the computer is going to shutdown and then restart the computer
shutdown /s /m PCtest /t 10
This command will shut down remote Server “
PCtest” after 10 seconds.
For other older switch (-) usage, Please the examples below.
shutdown -s (Shuts down) shutdown -r (Restarts) shutdown -l (Logs off) shutdown -h (Hibernates) shutdown -i (Interactive mode". Instead of performing an action, it displays a GUI dialog) shutdown -a (Aborts a previous shutdown command) shutdown -t 0 -r -f (Force an immediate reboot:) shutdown -t 30 -r (For a more friendly "give them some time)
I hope you found this blog post helpful. If you have any questions, please let me know in the comment session.