I’ve been working on project recently for a customer and needed to remotely enable remote desktop on several servers but they were located in a dark datacentre and there was no console access available. I know you can always enable this by editing the registry but this requires a server reboot which was not an option for me. So I decided to have a look at Powershell and found that the following commands enabled remote desktop without the need for a reboot.
(Get–WmiObject Win32_TerminalServiceSetting -Computername ServerNameHere –Namespace root\cimv2\TerminalServices).SetAllowTsConnections(1,1) | Out–Null
(Get–WmiObject –Class “Win32_TSGeneralSetting” -Computername ServerNameHere –Namespace root\cimv2\TerminalServices –Filter “TerminalName=’RDP-tcp’”).SetUserAuthenticationRequired(0) | Out–Null