Shutting down or restarting the server
I just couldn't resist starting with this one. Yes, this seems trivial. Silly even. However, the amount of times that I have watched a simple server restart consume more mouse clicks than creating a Domain Controller has convinced me that this needed to be in the book. Perhaps the shutdown and restart options were hidden away purposefully, because once your system is up and running, there is not often a need to accomplish either of these tasks. When first configuring the box though, it is very common to have to reboot a couple of times, or to shut down a machine to move it to another location.
To step through this recipe, you will need a Windows Server 2012 R2 system online. There are no other prerequisites.
Let's take a look at three different ways to shut down or restart your system. The first two are the most commonly employed. The third is less commonly known, but is by far my preference when tasked with restarting a remote server.
The first option would be to use the power button on the Start screen. So far, I don't think that many administrators have stumbled into this one, because it didn't exist in Server 2012.
- Click on your "Start Button", or rather your button in the Taskbar that opens your Start screen. You will see a power icon in the top-right corner of that Start screen.
- Click on this for Shut down and Restart options.
The second method to accomplish shutting down or restarting is by using the charms bar. The charms bar is the little menu that presents itself when you have your mouse sitting near the upper-right corner of your screen. On a touchscreen computer, you swipe your finger from the right side of the screen toward the middle to make it appear. Go ahead and hover the mouse in the upper-right corner of your screen until the charms bar appears. Then click on Settings, and then on Power. Unfortunately, this is the most common way to attempt to restart a Server 2012 R2 machine. I say unfortunately because it is so easy to hover in the corner and display the wrong charms bar, the one for your own Desktop for example.
Many mistaken reboots are caused by this.
The most definitive, and dare I say most fun way of restarting your server is to utilize Command Prompt. Doing this gives you the opportunity to double check that you are manipulating the correct machine. Open up Command Prompt and run a quick hostname
check to make sure you are restarting the one you really intend to. Then utilize the shutdown
command to take care of the rest. This process can be especially helpful when logged into remote servers using RDP. Use the following commands to perform the explained operations:
If you were to simply type shutdown
, the server would shut itself down in 60 seconds. Using /r
indicates a restart rather than a shut down, and /t 0
is a timing flag that indicates the number of seconds the server should wait before restarting. Specifying slash zero here tells it to wait for zero seconds before initiating the restart.
Shutting down or restarting a server doesn't require a lot of explanation, but I hope that this small recipe gets some thought going about creative ways to do regular tasks. As you will see throughout this book, you can accomplish anything in Windows Server 2012 R2 through the use of commands or scripts. You could easily turn the shutdown
command, the last example that we tested in this recipe, into a batch file, and place it on the Desktop of each of your servers as a quick double-click option for accomplishing this task.
However, I work with RDP windows inside RDP windows very often. When you're bouncing around between a dozen servers that all have the same background, I have decided that the only sure-fire way to make sure you are restarting the correct device is to do a quick hostname
check before you initiate the restart. If you are interested in discovering all of the available flags that are available to use with the shutdown
command, make sure to type in shutdown /?
some time to take a look at all of the available options.
Tip
Using the command prompt is also an easy way to log off a server. Let's say you are layers deep in RDP and want to log off from a single server (not all of them). Are you sure you clicked on the Start button of the right server? Instead, open up a prompt and simply type Logoff
.