HomeWindows 7 Tutorial

Restart a computer through remote desktop connection

1Reboot PC via remote desktop - Step 1

When you connect to another computer with a remote desktop session, you'll notice that the start menu doesn't include a "Restart" option, like it does on your typical Windows 7 PC. So, how do you reboot the remote PC?

2Reboot PC via remote desktop - Step 2

You can use batch files to automatically reconnect to a mapped drive, for example. The nice thing about this approach is that it doesn't require elevated privileges (you typically need the admin password to access some of the snap-in applets that let you meaningfully customize Windows servers). A batch file is essentially a text file that contains DOS-type command line instructions.

3Reboot PC via remote desktop - Step 3

So, launch Notepad to create a batch file we'll save on (or copy to) the remote computer. Type the following text in bold: shutdown -t 0 -r

Note: using hyphens (-) instead of slashes (/) makes this command backward-compatible. For a shutdown timer, replace the zero above by your desired number of seconds to wait before shutting down. If you're only dealing with PCs running Windows 7 / Vista or later, you can safely use the slashes.

4Reboot PC via remote desktop - Step 4

Now save the file as a batch file (*.bat). To make sure that it won't be saved as a plain-text file (Notepad default), enclose the file name, period, and bat extension between double quotes, as shown on the screenshot. Double-quotes aren't necessary if you know that Windows is set to show file extension on the remote computer (setting disabled in recent Windows versions). Just double-click on the batch file whenever you want to reboot the server / remote PC!

5Reboot PC via remote desktop - Step 5

Bonus Tip:
You can also shut down Windows on the remote PC, using the same command with a different switch. you can also save to a batch file. But remember that you won't be able to restart that machine remotely once it's turned off!
shutdown -s