Sean’s Stuff

17 January, 2009

How to Reboot Machine While Connected Through Remote Desktop

Filed under: Windows — Sean @ 4:24 pm
Tags: ,

I assume that everyone who uses Remote Desktop in Windows knows this already, but just in case…

I use Remote Desktop all the time to connect back to one or more machines on my home network.  I have a single static IP address and then have terminal server running on every box behind the router on a different port.  So I can connect to any of my machines remotely, by using a different port.

Being able to remote connect to any/all of my machines is huge.  I consider Remote Desktop to be one of the most critical tools that I use on a daily basis.

But  I occasionally find that there is something funky on one of my home machines that leads to my wanting to reboot it.  For example, I sometimes run into a situation where I can’t connect to the machine from outside my network, but I can still remote from a different machine in my home network.  So I remote to the “visible” machine, then remote over to the “invisible” machine.  Rebooting the problem machine seems to fix the problem.

The problem with rebooting is that the Shutdown and Restart options are removed from the Start Menu when you’re connected using Remote Desktop.

But not to worry–you can still reboot the machine, just using the command prompt.  Here’s the magic command (Windows 7, Vista or Windows XP):

shutdown -t 0 -r -f

That’s a “zero” after the -t option, indicating shutdown in zero seconds.  The -r option indicates a restart, rather than shutdown.  (Don’t forget this one)!  The -f option forces all applications to terminate.

So this is a critical command, worth remembering!

Advertisement

14 Comments »

  1. Good to know. thxs!

    Comment by reno — 17 January, 2009 @ 7:32 pm | Reply

  2. Great worked awesome!!!!!!

    Comment by Mike G — 23 March, 2009 @ 2:14 pm | Reply

  3. Pressing Alt-F4 in remote session will bring up the menu you need to shutdown or reboot.

    Comment by Mark — 28 July, 2009 @ 4:12 pm | Reply

  4. I think that Alt-F4 just closes the active application, no? (At least it does for me, remoted into a Win XP machine).

    Comment by Sean — 28 July, 2009 @ 5:32 pm | Reply

  5. Ahh, I see. Ok, Alt-F4 in Windows closes the active window/application–unless none of them has focus. So Mark’s suggestion is a good one, easier than bringing up a command shell.

    Simply click on the taskbar to remove focus from your current application window. Then press Alt-F4. This works in either WinXP, Win Vista or Win 7. Thanks Mark!

    Comment by Sean — 28 July, 2009 @ 5:34 pm | Reply

  6. you can also press CTRL-ALT-END which sends a CTRL-ALT-DEL though RDC to the host

    Comment by Adam — 15 September, 2009 @ 6:14 pm | Reply

    • ctrl-alt-end does not give shutdown options in windows 7.

      Comment by Tim — 14 January, 2010 @ 8:38 pm | Reply

      • Ctrl-Alt-End does show shutdown options. As Adam said, it sends a Ctrl-Alt-Del signal, which brings up the following options in the center of the screen: Lock, Log Off, Change Password and Start Task Manager. On a “real” Win 7 machine, rather that remote connected, you’ll also get an option to Switch User.

        That Ctrl-Alt-Del screen also has a red power icon in the lower right portion of the screen that includes the options: Restart, Sleep, Shut Down. On a “real” machine that you’re not remoted into, you’ll also see the Hibernate option.

        Comment by Sean — 14 January, 2010 @ 9:15 pm

  7. Thanks for the tip Sean, got here from the Googlenet!
    Worked on my Windows 7.
    You may want to edit the comment, below, in your article to include windows 7.
    “Here’s the magic command (Vista or Windows XP)”

    Comment by Lou — 21 December, 2009 @ 2:02 am | Reply

  8. Sean! Thanks for this entry.

    I’ve tried both methods here that got mentioned and they both worked on my Windows 7 machine while I was remoted into them.

    The Ctrl-Alt-End thing threw me until somebody mentioned the “power” button on the lower right. Presto.

    The “Click on the Taskbar and then type Alt-F4″ thing worked beautifully as well. Both of these are going into my handy commands file.

    I had used the Shutdown command from the DOS prompt, but always found that klunky. The other two are quite nice and quick.

    Comment by Greg — 21 February, 2010 @ 10:29 pm | Reply

  9. how i recover hard drive bad secteor.

    Comment by kamal paria — 23 February, 2010 @ 10:12 am | Reply

  10. It helped :)

    thanks a lot!

    Comment by alexanderb — 2 September, 2010 @ 10:34 am | Reply

  11. That works great!!

    Comment by Ashu — 20 April, 2011 @ 6:33 pm | Reply

  12. Why not just keep RDP running on the default port on all the computers and have your router forward different ports to port 3395 on different computers. Seems easier than reconfiguring each computer to run RDP on a different port.

    Comment by Mike — 23 June, 2011 @ 2:15 pm | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Theme: Rubric. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 320 other followers