+4 votes
5.8k views
Command to restart or shut down Windows Server 2019, 2016, 2012

in Windows Server by (551k points)
reopened | 5.8k views
windows server 2019 send remote restart command

1 Answer

+5 votes
Best answer

1. Shut down or restart Windows Server 2019, 2016, 2012 with Shutdown command
2. Restart Windows Server 2019, 2016, 2012 with Shutdown command
3. Shut down Windows Server 2019, 2016, 2012 with Shutdown command

Windows Server in its different versions give us a range of useful options for the management and delivery of roles and services not only to the server itself but also to the client computers of the domain, hence the importance of always preserving the availability and security of this..

For administrative or support reasons, at specific times it will be necessary to shut down or restart the server for a period of time. This should only be carried out with specific orders and knowing in advance that all users are aware of this task, since otherwise we can cause failures in certain activities or prevent communication and access to shared resources.

It is well known by each of us who have or are working in Windows Server that the shutdown and restart process is usually carried out through the Start menu and by clicking on the shutdown button:

image

But if in TechnoWikis we tell you that this process can be done through the command line , would you do it? We already told you that managing the shutdown or restart of Windows Server can be done through commands and it is quite simple. Therefore TechnoWikis will explain some commands to perform this task and this process applies in Windows Server 2012, 2016 or 2019 equally..

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


1. Shut down or restart Windows Server 2019, 2016, 2012 with Shutdown command

To use the command line, a general command called "shutdown" will be implemented, which has been integrated in all editions of Windows. Its elementary function is to turn off or restart the local or remote computer, to be taken into account, when we use this command without any parameter the device will shut down or restart immediately.
The general syntax of this command is the following:

 shutdown [{-l | -s | -r | -a}] [-f] [-m [\\ device]] [-t xx] [-c "message"] [-d [u] [p] : xx: yy] 
Parameters commando Shutdown
The parameters used are the following:
  • -l: this parameter closes the session of the current user.
  • -s: turn off the local server.
  • -r: this command will be used to restart the computer after its shutdown.
  • -a: it is a command with which the closing order is deleted, you can omit other parameters, minus -ly ComputerName.
  • -f: this parameter forces to execute applications to proceed with the closing.
  • -m [\\ ComputerName]: with this value we can indicate the equipment that has to be turned off.
  • -t xx: thanks to this value we can define the timer for the shutdown of the system in xx seconds, by default its value is 20 seconds.
  • -c "message": with this parameter we can integrate a message which will be displayed in the message area of ​​the server's shutdown window indicating that the computer has to be shut down or restarted, we can enter up to 127 characters.
  • d [u] [p]: xx: yy: this is a parameter with which the code is indicated for closing, the options are u (indicates a user code), p (indicates a planned shutdown code), xx (indicates the main code (0-255)), and y (allows you to specify the secondary reason code (0-65536)).

2. Restart Windows Server 2019, 2016, 2012 with Shutdown command


Knowing the use of the shutdown command, we will see how to restart our Windows Server from the terminal.
Step 1

For an immediate restart we will execute the following. Pressing Enter will restart the system automatically.
 shutdown / r / t 0 
image
Step 2

We can enter the period of time in seconds in which the system will be restarted, for example, if we want it to restart in 1 minute we will enter the following:
 shutdown / r / t 60 
Step 2

The following pop-up window will automatically be displayed:

image

Step 3

There is indicated the time that we have defined, so, after one minute the system will be restarted:

image

Step 4

Now, in case of having active applications and we want to force their closing, we must execute the following:
 shutdown / r / f 
image
Step 5

In the same way, if we manage networked equipment, we can restart them remotely using the following syntax:
 shutdown / r / f / m \\ EQUIPMENT 
Step 6

If we want to customize the restart, we can enter a message using the -c parameter like this:
 shutdown / r / t 45 -c "TechnoWikis Restart" 
Step 7

As a result we will see the following:

image


3. Shut down Windows Server 2019, 2016, 2012 with Shutdown command


We have seen how easy it is to restart Windows Server using the command line, now, this process is similar for shutdown.
Step 1

To shut down Windows Server immediately we will execute the following:
 shutdown / s / t 0 
Step 2

To program the shutdown we execute:
 shutdown / s / t 15 
Step 3

We will see the following. There we can see a message where it says that Windows Server will close in less than a minute.

image

Step 4

As with the previous commands, we can force the closure of applications using:
 shutdown / s / f 
Step 5

To turn off a remote device we will use:
 shutdown / s / f / m \\ EQUIPMENT 
Step 6

Finally, to add a shutdown message we execute:
 shutdown / s / t 30 -c "Shutdown TechnoWikis" 

image

Step 7

Using one of the above commands the result will be as follows:

image

Thus, we already have one more solution for shutting down or restarting our Windows Server in a simple way using the shutdown command and its parameters.


by (3.5m points)
edited

Related questions

+5 votes
1 answer
+4 votes
1 answer
asked Jun 15, 2020 in Windows Server by backtothefuture (551k points) | 769 views
+5 votes
1 answer
asked May 22, 2019 in Mac by backtothefuture (551k points) | 854 views
+3 votes
1 answer
asked Sep 20, 2019 in Windows Server by backtothefuture (551k points) | 1.5k views
+3 votes
1 answer
Sponsored articles cost $40 per post. You can contact us via Feedback
10,632 questions
10,764 answers
510 comments
3 users