Enable RDP on Windows 10 using Powershell

Just a small reminder for myself (and you):

If you ever need to enable RDP (mstsc) on a Windows 10 machine, and you can’t get to the System control panel item, use Powershell to enable RDP:

# Enable Remote Desktop
(Get-WmiObject Win32_TerminalServiceSetting -Namespace root\cimv2\TerminalServices).SetAllowTsConnections(1,1) | Out-Null
(Get-WmiObject -Class "Win32_TSGeneralSetting" -Namespace root\cimv2\TerminalServices -Filter "TerminalName='RDP-tcp'").SetUserAuthenticationRequired(0) | Out-Null
Get-NetFirewallRule -DisplayName "Remote Desktop*" | Set-NetFirewallRule -enabled true

Execute aboves cmdlets as Administrator in Powershell, and RDP should work.

To test the connection, open Powershell on another machine, and run:

Test-NetConnection 10.10.1.105 -CommonTCPPort rdp

Result should be as follows:

PS C:\WINDOWS\system32> Test-NetConnection 10.10.1.105 -CommonTCPPort rdp


ComputerName     : 10.10.1.105
RemoteAddress    : 10.10.1.105
RemotePort       : 3389
InterfaceAlias   : Ethernet
SourceAddress    : 10.10.1.247
TcpTestSucceeded : True

 

0 0 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x