Print this Post

Shutdown Computers from Command Line

SHUTDOWN Notification in Windows 8

SHUTDOWN Notification in Windows 8

I was recently surprised by how many seasoned IT Pros didn’t know that they had the ability to shut down a server or workstation from the command line using the SHUTDOWN command. Not only is it possible to shut down the local machine from the command line, but it is also possible to shutdown other machines on your domain as well.

Why is this important?

This is useful in many ways. Utilizing the command line shutdown routine, you can now script shutdowns or reboots of systems. If you have ever run Exchange or SQL, then you know they will take as much memory as possible to use as cache. While this makes your SQL or Exchange server perform better, the only way to get these systems to release memory is by rebooting. By using the SHUTDOWN command from the command line you can choose when to reboot your servers to reduce user downtime.

I have used this method many times to gracefully shutdown hung servers. As I’m sure you’re aware, shutting down a server gracefully is always preferable to taking it down hard by holding in the power button for 10 seconds. Taking a DC (domain controller) or SQL server down hard oftentimes leads to corruption (which sometimes isn’t noticed until years later).

How does it work?

First launch an administrative command prompt. For instructions on launching an administrative command prompt see my prior post titled How to Open the Command Prompt in Windows 7/Vista with Administrative Rights. From an administrative command prompt you have several combinations (type SHUTDOWN /? to see all options for the SHUTDOWN command). Here are a few examples to get you started:

The following will reboot the server with a five minute fuse. The “/R” switch indicates a reboot instead of a shutdown. The “/T” switch indicates the time in seconds until the reboot. When this line is executed all users with a desktop session on this system will get a notification that the server will shutdown. On some systems users will even get a countdown showing how long they have until the system is restarted.

The following command will shutdown the server immediately. The “/S” switch indicates you wish to shutdown the server instead of rebooting. The “/T 0” switch indicates time in seconds. Since zero seconds is indicated, the system will process the shutdown immediately.

This example will reboot a server on the network named SERVER1. The “/F” switch will force the shutdown regardless of any open applications or services. This is often helpful for hung or stubborn servers. The “/M \\SERVER1” switch indicates which remote machine will execute the command (in this case SERVER1).

About the author

Robert Borges

About Robert...

I have been in the IT industry since 1993 focusing mainly in networking. Though I got an early start as an amateur computer enthusiast, and wrote my first database app at age 12, I started my professional career working in the MIS department of one of the largest liquor distributors in the northeast. I started out there as a systems operator on the company’s two mainframe systems. From there I moved into PC support, and help design and implement the company’s first client-server network… This was back in the days of Win NT 3.51. I also worked on my first migration to NT 4.0 back then.

From there I went on to work with Novell 3.x and 4.x along with Windows domains and active directory environments. Working my way up from technician, to specialist, to administrator, and eventually all the way up to Sr. Engineer. I spent many years working for consulting firms, 9 of which I owned and operated my own firm.
Over the years, I have worked with (at an expert level) various versions of: Windows client and server operating systems (including Windows 10 and Windows Server 2016); various virtualization technologies (Hyper-V, VMware, etc.); MS-SQL server 6.5- 2014 R2; Exchange 4-2016, and much more.

I am now vCIO at Spade Technology, Inc. focusing on Information Technology strategy including: cloud computing, IT Infrastructure & Architecture, IT Security, and Cloud Computing platforms & technologies (SaaS, PaaS, and IaaS).

Outside of my day job, I serve as president of the board of Boston User Groups, Inc., as well as IT-Pro User Group. In 2017/2018 Microsoft awarded me the Microsoft MVP (Most Valuable Professional) Award, with a focus of Microsoft Azure cloud, for my efforts in the IT community.

I am in a constant state of learning about new products, and new versions of products. Many of which we end up implementing in lab environments and sometimes for our clients. I have a very broad range of expertise and experience. It is my goal to share some of this experience on this blog to help enrich the IT community.

Permanent link to this article: https://www.robertborges.us/2013/07/windows/shutdown-computers-from-command-line/

Leave a Reply