Lost in Cyberspace

Observations of Remote Desktop

Trevor Karjanis · October 11, 2020

A first blog post should always be downright boring. Compiled here is a list of notes and tips for new and experienced remote desktop (RDP) users. They’ll help you stay online through situations and mistakes particularly in times when asking for help to recover a lost machine is a lot to ask.

Enable Remote Desktop

It’s elementary, but for first time users and new machines it’s important to note. The remote desktop feature is likely disabled. Check your platform’s documentation for how to enable it.

Identify Fully Qualified Domain Names

Depending on the organization of the private network, hostnames may fail to resolve over VPN, and IP addresses may be subject to change. Take note and configure remote desktop connections with the fully qualified domain name of the remote computer. Note the IP address as well to ensure you have a backup address in the case of adverse complications. On Windows, see the DNS suffix and IP address provided by ipconfig.

Enable Wake on LAN

The magic packet defined in the Wake on LAN (WoL) standard can be encapsulated in a routable, connectionless IP packet. Therefore, many utilities do so, and enabling WoL can be beneficial in waking a remote computer from a low power sleep state. However, a computer’s IP address can change while it is powered off. The standard requires the use of a broadcast address which is blocked by most routers, including over VPN. Resolution requires configuring all intermediate routers or a WoL gateway. Alternatively, leave a device accessible on the local subnet. By the time I’ve accessed VPN and started my development machine, I’m running at least four active computers: phone, laptop, development machine, test machine, and frequently remote test devices. In consideration for excessive consumption, I leave the test machine available from which I wake others.

Wake on LAN does not work for all sleep states, so take care when restarting or configuring power settings. Do not mistake the shutdown /h option for the shutdown help command — results may vary.

Enable AC Power Recovery

Wake on LAN won’t work when a computer is fully powered off. Even hibernating computers will not return if power is lost. Enable AC power recovery to ensure a machine remains accessible after an ungraceful shutdown. If it’s supported, it can be found in the BIOS settings. If you’re already remote, check the device manufacture for an application that can configure it from the operating system like Dell Command | Configure. For a guarantee and especially for computers that sleep anyway, I configure mine to power on rather than to the last sleep state after power is restored. Since it’s harmless, I also configure them to power on every morning at six just in case of an anomaly.

As of version 4.0, Dell Command | Configure requires WMI-ACPI BIOS support. Check the list of supported platforms. If the device model is not supported, try version 3.3.

Enable RDP Remotely

In the event that access is required to a new computer, check if remote desktop can be enabled remotely. Anthony Eden’s article on Media Realm covers how to do so with Windows 10 and PsExec. The remote account must have adminstrative privileges. Also, this will not work when connecting from a computer on a different domain, like connecting with a local account.

  1. Start a command prompt on the remote computer.
    psexec \\<hostname> -u <domain> <username> -p <password> -h cmd
    
  2. Open the firewall port for remote desktop.
    netsh advfirewall firewall set rule group="remote desktop" new enable=Yes
    
  3. Configure the registry to enable remote desktop.
    reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
    
  4. Start the remote desktop service.
    net start "remote desktop services"
    

Remote Recovery

The remote desktop service can become unresponsive. I found a machine inaccessible following an IT scheduled update, likely due to issues shutting down processes before restarting. Updates can also disable the feature. In which cases, it may be necessary to recover the system by executing remote commands with protocols like Secure Shell (SSH). PSExec is a light-weight utility for Windows that can launch interactive command prompts. Windows system commands like shutdown, services, and regedit also have remote support. If AC power recovery is not enabled, care should be taken with the shutdown command. Also of note, mind the target when using services.msc. When restarted, it uses the previously connected computer.

Lookup and Test an Address

Use the ping command to test address resolution and connection speed. Provided with a hostname, ping will resolve the IP address. Remember, the FQDN may be required. On Windows, the ping -a <ip address> command will reverse lookup the hostname and return the FQDN if successful. Providing an IP address to nslookup will do the same.

It is possible to retrieve a MAC address with which to use with WoL, however, it will only work to lookup addresses on a local subnet. First, ping the address. This will populate the arp cache tables which are then accessible with arp -a <ip address>.

Don’t Use Remote Desktop

Enough internal resources may be accessible with just VPN that RDP may not be necessary. This alternative likely requires replicating the desktop work environment locally but avoids many of the common pitfalls of remote access. Issues with bandwidth and latency can result in grainy or incorrect visuals, laggy cursors, skips, freezes, and unusable video and sound. A native desktop experience may provide an easier and more productive solution in general. It’s important to know and comply with organizational rules and requirements as well as national laws and regulations. Your organization may restrict certain resources on personal devices or may have additional restrictions for certain environments like public networks. At the least, they likely require anti-virus software, and your government likely imposes export controls that need to be carefully considered.

Twitter, Facebook