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:

# Set registry
$key=$base.OpenSubKey('SYSTEM\CurrentControlSet\Control\Terminal Server',1)
# Restart service
Get-Service TermService -comp $computerName | Restart-Service -force