Search

How to shut down or restart Windows 2022

Sometimes it is difficult to locate the shut down or restart buttons in Windows Server Desktop. You may shut down or restart Windows Server using Windows Graphical User Interface or Command Prompt terminal (cmd.exe) or using PowerShell terminal.

How to shutdown or restart Windows Server 2022 using Graphical User Interface

Follow below steps to shutdown or restart Windows Server 2022 using Windows Graphical User Interface.

Step 1 - Click Windows start menu button on extreme left-bottom corner from Windows Server desktop. Windows start menu button is shown in below screen shot.

windows-server-startmenu-button.jpg

 

Step 2 - Click on "Power" on start menu as shown below.

windows-server-startmenu-power.jpg

 

Step 3 - Click on "Shut down" or "Restart", as you require.

power-shutdown-restart.jpg

 

Step 4 - Now you need to choose a proper reason for this shut down, or restart. Select the reason for shut down or restart from the drop-down menu, as shown in below images. Click "Continue" button after selecting a proper reason for the shutdown or restart

windows-server-shutdown-restart-reason-1.jpg

 

windows-server-shutdown-restart-reason-1.jpg

 

Step 5 - Now Windows Server will display a warning message, showing that if you shut down the machine now, any unsaved work from other user logins will not be saved and lost. If you are sure that currently any other user is not logged-in to the Windows Server, click "Shut down anyway" button. If you have any unsaved works, go back and save all your unsaved works before clicking "Shut down anyway" button.

windows-server-shutdown-warning.jpg

Now the Windows Server will shut down or restart, according to the option you had selected from the 3rd step.

 

windows-server-shutting-down.jpg

 

You may also shut down or restart Windows Server from right-clicking the start menu and then clicking the "Shut down or sign out" menu, as shown below.

right-click-windows-startmenu.jpg

 

How to shutdown or restart Windows Server 2022 from Command Prompt terminal (cmd.exe)

To shutdown or restart Windows using Command Prompt (cmd.exe), you need to run cmd.exe as administrator. To run Command Prompt (cmd.exe) as administrator, search for "cmd" from Windows search box. Right-click "Command Prompt" from search result. Click "Run as administrator" from the context menu. Click following link to learn how to run any program as administrator.

Refer below screen shot.

run-command-prompt-as-administrator.jpg

 

The command used to shutdown or restart Windows from Command Prompt (cmd.exe) is shutdown.exe. To see all options available for shutdown.exe, view help by typing shutdown.exe /? from Command Prompt. The output is shown below.

C:\jajish>shutdown.exe /?
Usage: shutdown.exe [/i | /l | /s | /sg | /r | /g | /a | /p | /h | /e | /o] [/hybrid] [/soft] [/fw] [/f]
    [/m \\computer][/t xxx][/d [p|u:]xx:yy [/c "comment"]]

    No args    Display help. This is the same as typing /?.
    /?         Display help. This is the same as not typing any options.
    /i         Display the graphical user interface (GUI).
               This must be the first option.
    /l         Log off. This cannot be used with /m or /d options.
    /s         Shutdown the computer.
    /sg        Shutdown the computer. On the next boot, if Automatic Restart Sign-On
               is enabled, automatically sign in and lock last interactive user.
               After sign in, restart any registered applications.
    /r         Full shutdown and restart the computer.
    /g         Full shutdown and restart the computer. After the system is rebooted,
               if Automatic Restart Sign-On is enabled, automatically sign in and
               lock last interactive user.
               After sign in, restart any registered applications.
    /a         Abort a system shutdown.
               This can only be used during the time-out period.
               Combine with /fw to clear any pending boots to firmware.
    /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.
    /fw        Combine with a shutdown option to cause the next boot to go to the
               firmware user interface.
    /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), with a default of 30.
               If the timeout period is greater than 0, the /f parameter is
               implied.
    /c "comment" Comment on the reason for the restart or shutdown.
               Maximum of 512 characters allowed.
    /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 [p|u:]xx:yy  Provide the reason for the restart or shutdown.
               p indicates that the restart or shutdown is planned.
               u indicates that the reason is user defined.
               If neither p nor u is specified the restart or shutdown is
               unplanned.
               xx is the major reason number (positive integer less than 256).
               yy is the minor reason number (positive integer less than 65536).

Reasons on this computer:
(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)
E       2       2       Operating System: Recovery (Unplanned)
E P     2       2       Operating System: Recovery (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
 U      5       19      Security issue (Unplanned)
E       5       19      Security issue (Unplanned)
E P     5       19      Security issue (Planned)
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

 

Most important options of "shutdown.exe" are listed below. Note that below commands will not display any warning to save your session’s or other user session’s works. Make sure your session’s works or other user session’s works are saved before running shutdown.exe command for shutdown or restart Windows Server.

Shutdown Command Option Description
shutdown.exe /s Shutdown Windows without specifying a time gap to shutdown. Default time gap for shutdown after the command run is 30 seconds.
shutdown.exe /r Restart Windows without specifying a time gap to restart. Default time gap to shutdown for restart after the command run is 30 seconds.
shutdown.exe /l Logoff current user. Windows Server will logoff immediately after the command is run. Be careful, no warning will be displayed.
shutdown.exe /f Force shutdown, after closing all applications. Be careful, no warning will be displayed.
shutdown.exe /a Abort shutdown or restart command run earlier. Run this command before time gap.
shutdown.exe /s /t Specify a time gap to shutdown Windows Server in seconds.
shutdown.exe /s /t Specify a time gap to shutdown Windows Server to restart, in seconds. Example; shutdown.exe /s /t 0 specifies a 0 second shutdown (means immediate shutdown)

 

"shutdown.exe /s" command to shutdown Windows Server

shutdown.exe /s command is used to shutdown the computer, without specifying any time gap. Default time gap for Windows Server to shutdown after running the command is 30 seconds. Please refer below image.

shutdown-s-command-run.jpg

 

"shutdown.exe /r" command to restart Windows Server

shutdown.exe /r command is used to restart the computer, without specifying any time gap. Default time gap for Windows Server for shut down for restart after running the command is 30 seconds. Please refer below image.

shutdown-r-command-run.jpg

 

"shutdown.exe /l" command to logoff current user from Windows Server

shutdown.exe /l command is used to logoff current user from Windows Server. User will be logged-off from Windows Server immediately after the command is run.

 

"shutdown.exe /s /t ( time gap )" command to shutdown Windows Server after a time gap

"shutdown.exe /s /t ( time gap )" command is used to shutdown Windows Server, after a specific time gap. Below example can be used to specify 120 seconds (2 minutes) time gap for the Windows Server to shutdown, after the command is run.

If you want to abort the shutdown command, you may close the warning dialog box and issue a shutdown /a command before specified time gap is elapsed.

shutdown.exe /s /t 120

 

shutdown-s-t-command-run.jpg

 

"shutdown.exe /r /t ( time gap )" command to restart Windows Server after a time gap

"shutdown.exe /r /t ( time gap )" command is used to restart Windows Server, after a specific time gap. Below example can be used to specify 120 seconds (2 minutes) time gap for the Windows Server to shutdown for restart, after the command is run.

shutdown.exe /r /t 120

 

shutdown-r-t-command-run.jpg

 

How to shutdown or restart Windows Server 2022 from PowerShell terminal

How to shutdown Windows from PowerShell terminal

Stop-Computer PowerShell cmdlet is used to shutdown local or remote Windows Server machines. Windows Server will be shutdown immediately after the cmdlet is run, without showing any warning. Take utmost care before running Stop-Computer PowerShell cmdlet. An example is shown below.

Stop-Computer OmniSecu-Serv02

 

In above example, OmniSecu-Serv02 is the name of the Windows Server, to shutdown. If no computer name is given, local computer will be shutdown.

Refer following link for Stop-Computer PowerShell cmdlet official Windows documentation.

How to restart Windows from PowerShell terminal

Restart-Computer PowerShell cmdlet is used to restart Windows Server on local and remote computers. Windows Server will be shutdown immediately for restart, after Restart-Computer PowerShell cmdlet is run, without showing any warning. Take utmost care before running Restart-Computer PowerShell cmdlet.

Restart-Computer OmniSecu-Serv02

 

In above example, OmniSecu-Serv02 is the name of the Windows Server, to restart. If no computer name is given, local computer will be restarted.

Refer following link for Restart-Computer PowerShell cmdlet official Windows documentation.

 

Written by Jajish Thomas.
Last updated on 18th May, 2022.

 

Related Tutorials
Introduction to Windows Server 2022
New features of Windows Server 2022
Hardware requirements for Windows Server
Different editions of Windows Server 2022
Difference between Server Core and Server with Desktop experience (GUI)
How to install Windows 2022 Server
How to use search functionality in Windows Server 2022
How to hide or unhide search box
How to add This PC icon to desktop in windows 2022
How to add Network icon to desktop in windows 2022
How to rename computer name in Windows 2022
How to rename computer name using PowerShell
How to configure IPv4 Address in Windows 2022
How to configure IPv6 Address in Windows 2022
How to configure IPv4 address Windows 2022 using PowerShell
How to configure IPv6 address Windows 2022 using PowerShell
How to shut down or restart Windows 2022
How to sign out from Windows Server 2022
How to run a program or app as administrator