Our website use cookies to improve and personalise your experience and to display advertisements (if any). Our website may also include cookies from third parties like Google Adsense, Google Analytics, Youtube. By using the website, you consent to the use of cookies.

Blog Post

Remotely Enable Remote Desktop via Powershell

powershellI’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.

(GetWmiObject Win32_TerminalServiceSetting -Computername ServerNameHere Namespace root\cimv2\TerminalServices).SetAllowTsConnections(1,1) | OutNull

(GetWmiObject Class “Win32_TSGeneralSetting” -Computername ServerNameHere Namespace root\cimv2\TerminalServices Filter “TerminalName=’RDP-tcp’”).SetUserAuthenticationRequired(0) | OutNull

Related Posts