Home > Computers > Restart Windows Remotely through VPN

Restart Windows Remotely through VPN

December 3rd, 2005 Tony Leave a comment Go to comments

I often remotely control Windows machines at my office via Remote Desktop and VPN when I’m traveling. Ocassionally a Windows machine will stop responding to requests for Remote Desktop and the only solution I’ve found is to restart the machine but thats difficult to do when you are in London, its 3AM EST, and there isn’t anyone in the office to flick the reset switch for you.

The Solution
First install OpenSSH. This handy app creates a Windows NT service on your machine that allows you to SSH to the box and run DOS commands remotely. Once the installer completes you need to setup the local Windows users that you want to be able to SSH with. (In my example I won’t specify a user which defaults to all Windows users)

Open up DOS and execute the following (change d:\apps\OpenSSH to your install folder):

cd d:\apps\OpenSSH\bin
mkgroup -l >> ..\etc\group
mkgroup -d >> ..\etc\group
mkpasswd -l >> ..\etc\passwd
mkpasswd -d ..\etc\passwd

Now start the OpenSH service for the first time:

net start opensshd

The OpenSSH service should be running now. To test it go to another machine and attempt to SSH in.

SSH control of Windows computer

Cool! We’re in.

Finally we want to reboot the machine. Executing the following in the SSH client will restart the machine and force any apps to close. You will lose any unsaved work on the machine.

shutdown -r -f -m \\computername

The shutdown alert is displayed on the remote machine and 30 seconds later it is restarted!

Shutting down!.
I had to work fast to capture that screen shot! :)

Categories: Computers Tags:
  1. Rocky
    March 13th, 2006 at 23:46 | #1

    There is an excellent little “freeware” program that will shut off computers from remote access, if your in the ‘group’, etc. It’s called “Poweroff” and can be obtained from http://users.pandora.be/jbosman/applications.html
    or do a search for “poweroff”. It works greater than all these extra commands and does much more. Give it a try.

  2. October 8th, 2007 at 00:44 | #2

    this is great!! I forgot to reboot my computer Friday. There were all kinds of updates that I needed to reboot my computer for. I was afraid that first thing Monday (tomorrow) – my day would be delayed 15mins from me having to reboot. I just did it with this tip and so I should be able to hit the ground running tomorrow morning! Thanks!