How to Restart Windows Server 2012 Using Command Line

How to Restart Windows Server 2012 Using Command Line

Windows operating systems provide the commandshutdown which has a lot of functions like a reboot, shutdown, logoff, etc. In this tutorial, we will look most useful of them. Windows XP is a very old operating system where it may lack some of the options and features described here. We will use tocmd.exe run from CLI.

Syntax

shutdown command syntax is like below.

shutdown OPTIONS COMPUTER COMMENT
  • OPTIONS is used for different types of options like restart, logoff, etc.
  • COMPUTER is used when we need to run shutdown command on the remote computer
  • COMMENT is used with comment feature to provide a message.

Print Help For Shutdown Command

Help information about the shutdown command can be listed with the /? options. This will list all available options and short description about the options.

>  shutdown /?
Print Help For Shutdown Command

Shutdown System

Now the main purpose of the shutdown command is shutting down the system or computer. Just providing the command is not enough to power off the computer. We should provide the option /s in order to shut down the system.

> shutdown /s
Shutdown System

The shutdown command will not shutdown the computer immediately. It will take about 1 minute to complete shutdown. Before the shutdown the current user session will be closed properly to prevent data loss.

Restart System

We can also restart the system with the commandshutdown. We will provide the option /r in order to restart the system or computer. This will shut down and restart the computer.

> shutdown /r

Logout From Current GUI Session

If we have logged in with the GUI we may need to log out from the current session. We will use the option /l in order to log out from the current user session.

> shutdown /l

Abort/Cancel System Shutdown

By default when we issue shutdown command the computer will not shut down immediately. There are 60 seconds wait time before shutdown. We can cancel the shutdown operation with which/a means abort.

> shutdown /a
Abort System Shutdown

Then the shutdown is cancelled we may see a message like "Logoff Cancelled" in the bottom right corner of the screen.

Hibernate System

Hibernate features will make computer sleep and wake up in seconds without starting from scratch. We can hibernate the computer with the option/h like below.

> shutdown /h

If the hibernation is not enabled we may see an error like "Hibernation is not enabled on this system. You must enable hibernation in order to use the -h option.(126)". So we should enable hibernation from "Power" options.

Hibernate System Error

Send Message To System Users

A typical server will be used more than one person. There may be other persons who are using server currently. We need to provide information about a shutdown, restart. We can use the option/c with the message. The message will be put into double quotes.

> shutdown /s /c "The system will be shut down in 60 seconds."

Specify Time or Interval For  Shutdown and Restart

Default shutdown interval or time may be enough for us or other computer and system users. We can specify the interval we need with the option/t and time value. In this example, we will specify a waiting time for 120 seconds for the shutdown. Merging this option with send message will be very useful.

> shutdown /s /t 120 /c "Shutdown in 120 seconds"

Show Shutdown GUI

shutdown command provides a very useful GUI or dialog box. In order to open GUI for shutdown command, we will provide the "/i" option. This dialog box is named "Remote Shutdown Dialog" which is mainly designed to shut down or reboot the remote systems. But we can also use it for the local system too. But keep in mind that this must be first option for the shutdown command.

Show Shutdown GUI

Here we can use the "localhost" for the Computers list. Also the "Comment" can not be empty in order to complete shutdown or reboot operation.

Immediately Shutdown without a Warning

By default, the shutdown operation will have some time-out and warning for the users. But this takes some time for about 40 seconds. We can skip this waiting time and immediately shut down the system without a warning with the option /p.

>  shutdown /p

.

Source: https://www.poftut.com/shutdown-cmd-windows-command-line-shutdown-command-examples-tutorial/

Posted by: dalleyrompubse.blogspot.com

0 Response to "How to Restart Windows Server 2012 Using Command Line"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel