+5 votes
406 views
Command to restart or shutdown Windows Server 2022

in WindowsServer by (552k points)
reopened | 406 views

1 Answer

+3 votes
Best answer

1. Restart Windows Server 2022 with commands
2 . Shut down Windows Server 2022 with commands

Windows Server 2022 is the new edition of this business operating system which we know offers us a great set of roles and services so that the administration tasks are as complete, but at the same time simple as possible. Among many functions available there are some typical ones such as shutting down and restarting the server, as administrators these tasks are carried out exclusively when support tasks have to be performed since a shutdown or restart of the server in a productive environment will prevent the users have access to the server and its respective objects..

 

Normally we carry out these actions from the Start menu and there we click on the shutdown or restart button, but there is another option and that is to carry out these tasks directly from the CMD console and TechnoWikis will explain how to do it in Windows Server 2022.

 

 

Command shutdown
All these tasks are possible thanks to the shutdown command, its usage syntax is as follows:
 shutdown [{-l | -s | -r | -a}] [-f] [-m [\\ computer]] [-t xx] [-c "message"] [-d [u] [p] : xx: yy] 

 

Shutdown parameters
The parameters used are:

 

  • -l: close the current user session.
  • -s: shut down the local server.
  • -r: allows you to restart the computer after it has shut down
  • -a: remove the close command, you can omit other parameters, less -l and ComputerName.
  • -f: forces to run applications to proceed with the shutdown.
  • -m [\\ ComputerName] - Reference the computer to be shut down.
  • -t xx: allows you to define the timer for shutting down the system in xx seconds, by default its value is 20 seconds.
  • -c "message": gives us the option to integrate a message to be displayed in the message area of ​​the server shutdown window, admits up to 127 characters.
  • d [u] [p]: xx: yy: allows us to indicate the code for the shutdown, the options are u (indicates a user code), p (indicates a planned shutdown code), xx (indicates the main code ( 0-255)), yy (allows you to enter the secondary reason code (0-65536)).

 

 

 

To stay up to date, remember to subscribe to our YouTube channel!   SUBSCRIBE

 

 


1. Restart Windows Server 2022 with commands

 

Step 1

Access the command prompt, there we restart the server with the syntax:
 shutdown / r / t time 
image

 

 

Note
if we set the value 0 the server will be restarted immediately, the values ​​are expressed in seconds.

 

Step 2

We will see the message displayed indicating the action to be taken:

 

image

 

 

Step 3

After this the system will be rebooted:

 

image

 

 

Step 4

If we want to add a message, we must add the -c parameter:
 shutdown / r / t time -c "message 
image

 

 

Step 5

Pressing Enter we will see the message entered. After this Windows Server 2022 will restart.

 

 

image

 

Step 6

If there are active applications, it is possible to force their closure, we execute the following:
 shutdown / r / f 
Step 7

to restart a remote computer in the domain we execute:
 shutdown / r / f / m \\ EQUIPMENT 

2 . Shut down Windows Server 2022 with commands

 

Step 1

Now, to turn off Windows Server 2022 from the console we have identical options, for this we access the command prompt and to turn off the server we execute the syntax:
 shutdown / s / t time 
image

 

Step 2

We observe the message displayed. There the date and time are indicated in which the server will shut down, after this the system will be shut down.

 

 

image

 

Step 3

To add a message we use the -c parameter in the following way:
 shutdown / s / t time -c "message 
image

 

 

Step 4

Look at the message displayed:

 

image

 

Step 5

After this the server will shut down according to the order given:

 

image

 

 

Step 6

To force the closing of the applications we execute:
 shutdown / s / f 
Step 7

To shut down a remote computer we will use the syntax:
 shutdown / s / f / m \\ EQUIPMENT 
These are the options available to restart or shutdown Windows Server 2022 from commands.

 


by (3.5m points)

Related questions

+4 votes
1 answer
asked Feb 17, 2021 in WindowsServer by backtothefuture (552k points) | 255 views
+4 votes
1 answer
asked Feb 11, 2021 in Windows 10 by backtothefuture (552k points) | 324 views
+4 votes
1 answer
+4 votes
1 answer
+5 votes
1 answer
asked Feb 15, 2021 in WindowsServer by backtothefuture (552k points) | 390 views
Sponsored articles cost $40 per post. You can contact us via Feedback

Most popular questions within the last 30 days

10,659 questions
10,791 answers
510 comments
3 users