RDP wake-on-lan in LAN environment

22

16

How do you configure RDP to be able to wake-on-lan client computers?

Basically, I want to be able to wake-on-lan 1 or more computers at a time in our LAN environment.

oshirowanen

Posted 2014-01-04T10:46:17.620

Reputation: 1 858

This would be a nice a feature indeed. I'm on Windows 8.1 with Update 1 and there is still no WOL option built in to MSTSC. Not even on the Windows 10 TP. – Samir – 2014-12-30T15:13:46.377

I do WOL through my DD-WRT, and then run MSTSC and resolve hostname through NetBIOS. The remote PC is set to Magic Packet. Perhaps changing this to Pattern might help it wake up at TCP SYN request as suggested below. I haven't tried this. Also, all my Windows 8 machines seem to have this strange problem of waking up randomly and unintentionally via NIC, and setting the WOL trigger to Magic-Packet-only appears to reduce the problem. For that reason I prefer Magick Packet trigger. I didn't have this issue in Windows 7, so random wakes might not affect you if you are still using Windows 7. – Samir – 2014-12-30T15:17:57.410

I did a quick test now and I can confirm that deselecting the Magic-Packet-only option in the power settings for NIC (i.e. allowing Pattern trigger) allows you to wake the remote PC via MSTSC (RDP). Note that RDP connection will fail the first time (you will get an error). This only serves to wake the remote PC. Once waken up, the second RDP connection attempt will be more successful. Tested on two LAN PCs running Windows 8.1 Update 1. (Use the remote hostname instead of IP address.) – Samir – 2014-12-30T15:48:43.833

Windows XP ? 7 ? – Lawrence – 2014-01-11T13:35:40.220

MS Windows 7 Pro – oshirowanen – 2014-01-11T13:36:46.587

Answers

28

Remote Desktop does not have any built-in remote wake-up capability. You will need to first use Wake-On-Lan to wake up the sleeping computer, before you can RDP to it.

To enable WOL on your computer, the first step is to check the hardware :

  • Your network card must support Wake-on-LAN
  • Your power supply must support Wake-on-LAN
  • Wake-on-LAN must be enabled in BIOS
  • Your router must be configured to forward broadcast packets
  • Your OS must be configured to enable Wake-on-LAN

Enable WOL in BIOS (from boot)

The actual method depends on your motherboard. However, if no such option is found in the BIOS, it might be safe to assume that it will work by default.

Enable WOL for your Ethernet Card

Open Device Manager from the Control Panel, expand Network Adapters and find your Ethernet Card. Right-click and open Properties then go to the Advanced tab and enable "Wake on Magic Packet" or something similar.

image1

Install Windows Feature "Simple TCPIP services"

Open Programs and Features from the Control Panel, click "Turn Windows features on or off" on the sidebar, scroll down and check "Simple TCPIP services", then click OK to install the feature.

image2

Start Service "Simple TCP/IP Service" (enables ports 7 & 9)

Open Services from Administrative Tools in Control Panel, scroll down to the service, ensure the service is started and that its Startup Type is set to Automatic so that it will run with Windows.

image3

Open UDP for Port 9 in Windows Firewall

Open Windows Firewall from Control Panel. Only UDP is needed, but you can if you wish open the TCP port as well. UDP is a broadcast packet which can always be received by your NIC, whereas TCP requires the computer to be powered up.

image4

WOL software

Many such are available on the Internet, by command line like wolcmd or its matching Graphical Interface found here.

source

harrymc

Posted 2014-01-04T10:46:17.620

Reputation: 306 093

5We use WOL extensively, and we haven't enabled Simple TCP/IP services or the firewall exception. If the machine is off, the firewall is not even running to block the WOL packet. – Patrick Seymour – 2014-01-18T11:58:21.590

1@PatrickS.: These items are part of the standard cookbook receipt for WOL, but your comment about them being superfluous does seem entirely logical to me. I would be perhaps careful about the firewall part, since firewalls are getting more sophisticated all the time. – harrymc – 2014-01-18T15:19:19.507

4I'm not sure how software firewalls would stop packets when they're not running. And even if Simple TCP/IP opens port 7 and 9, that service is not running either when the PC is off. And WOL does not require either port 7 or 9. – Patrick Seymour – 2014-01-18T20:29:33.127

@PatrickS.: I was thinking future-wise. – harrymc – 2014-01-18T20:52:16.280

3

If the machine is a Physical machine, then you first configure it's BIOS to allow wake-on-lan and just send it a WakeOnLan packet, using any other software (there are many free ones) and then separately RDP to it.

If on the other hand they are Virtual Machines, then you have a problem. WOL relies on the NIC to do the wake, and in a VM you have virtual NICs not physical ones. In that case, you are dependent on your virtualization tool to support the WOL, if it supports it and is enabled, then you will send a WOL packet, as if you are doing it to a physical machine.

Note: With the default windows RDP client, you cannot configure a script to run prior to the connection, only after. I suggest you package mstsc.exe to run inside a BAT script that sends the WOL packet, waits for a few minutes and then launches mstsc.exe (i.e. the RDP client).

How-to-guide assuming physical machines (OS doesn't matter): http://www.smallnetbuilder.com/lanwan/lanwan-howto/29941-how-to-wake-on-lan--wake-on-wan VMWare settings (one example, you need to search for your specific vendor and version): http://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.vsphere.vm_admin.doc_50%2FGUID-35CD5E60-6FFA-47CE-A5CF-78B6D6B42CB8.html

KGA

Posted 2014-01-04T10:46:17.620

Reputation: 61

1Note, you can assign a VM to a physical NIC, and does happen quite often in a server environment – cutrightjm – 2014-01-11T19:40:57.893

2

Using Wake On Pattern would seem to be the way to go for this. As long as Wake On Lan is enabled in the BIOS as well as in Windows.

I haven't done it myself, but I know that WOL can be done on Name Lookups as well as TCP SYN requests.
This Microsoft KB doco specifies as much also.

Assuming that you're connecting to an IP address and not a hostname, connecting to the IP should attempt to send a TCP Syn request to the computer, as long as the switch has not forgotten which IP address has that MAC address.

By default, Windows 7 should be setup to wake on either MagicPacket and PetternMatch. The latter is what will take care of waking on TCP Syn requests.
However, the NIC itself will need to support ARP & ND offload, or at least ARP offload.
If the NIC doesn't support that, then Magic Packet is the only way to wake up the computer.

In which case, you will need a utility to run before attempting to connect with RDP to the computer. Your network infrastructure may even have the ability to send Wake On Lan packets for you.

Lawrence

Posted 2014-01-04T10:46:17.620

Reputation: 3 807