|All blog entries are the opinions of the author and do not necessarily reflect the opinions of their employer. All the code presented is for explanation and demonstration purposes only. Any damages incurred to your site and/or data are not the responsibility of the author. Every effort is taken to ensure the code properly compiles, however sometimes there are some hiccups and you might be required to do your own debugging.
Ever want to reboot a remote Windows server? How hard can it be?
Thursday, October 11, 2018 5:00 PM
Imagine this scenario, you’re working on a remote server, and something goes sideways (aka something goes south, something bad happens, the s@#$%T hits the fan, something is FUBARd and you need to reboot the box), what do you do? I said you’re remote right? “Uh, Peter, just reboot the box by going to the Start menu, using Power and Restart. You know, like this.”
hhhmmm How do I bite my lip, be respectful, yet show them that I’m not some noob and that the problem is when you’re signed into a server remoted (in Windows), and chances are good your IT\Lan or network admins have locked out users from being able to restart\reboot the box.
Are you hooped? Well, yes, IF you don’t have access to the command prompt (cmd.exe).
If you have command prompt access, then you should be ok (if you have to ask what this is….then maybe you shouldn’t be playing with this stuff?). With cmd, you can
- shutdown /?
- which likely shows you two\three\four screens of help. The key options you are probably going to want are /p to shut down NOW! (ie no warning),
- shutdown /p
- shuts down your box right F!@#$%^G NOW!
- as you can imagine, use with caution, don’t forget, with the machine being remote, you might not have immediate access to turning it back on
- I’ve done this with the machine being behind locked\secure doors, I’ve done it with the server across town, I’ve even done it to a server box which refused to turn back on
- IMHO, use with extreme caution
- shutdown /r
- default is to give you a minute before shutting down the box
- you have time to think about it and well, abort it.
- shutdown /a
- will abort the shutdown
- can be useful if you did something by accident\erroneously
- shutdown /r /t 10
- now THIS is the one you want to use to restart the box in 10 seconds
- of course you can change that to a 1 if you really want
- if you forget the timespan, it’s as if you use /? and you’ll get help again
- funny enough, when you do this command (ie with the 10), you will see the same screen as above, BUT rest assured, it WILL reboot in 10s
Now that you know how to reboot a remote box, it’s not that hard!
PS Please be careful when doing this. The key premise to this article is you’re doing this on a remote box. It is VERY easy to accidentally restart….the box……you’re currently on. DOH! hhmmmm Yup, I accidentally did just that while writing this article. Almost funny, but I realized it was an easy enough mistake. Like leaving the headlights on for your car, you’ll do it once, ONCE! After you have to go through the hassles of getting a boost in the middle of the night…you’ll learn your lesson…the heard way. (uhm, yeah, I did it twice, I learn by doing…. with practise apparently LOL)