Enabling Remote Desktop Remotely

less than 1 minute read

According to this Technet article, to enable remote desktop remotely by using the registry you need to set the key

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server:fDenyTSConnections=0

and then reboot the server.
Rebooting is actually unnecessary - you can just restart the service TermService
If you’d like to script it all:

param([string]$computerName='.')
# Set registry
$base=[Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine',$computerName)
$key=$base.OpenSubKey('SYSTEM\CurrentControlSet\Control\Terminal Server',1)
$key.SetValue('fDenyTSConnections',0)
$key.close()
$base.close()
# Restart service
Get-Service TermService -comp $computerName | Restart-Service -force