enable RDP from Powershell

to enable RDP on 1 server its quite simple if you’re using the server GUI –

System Properties/Remote tab

SystemProperties_RDP

 

 

 

 

 

 

 

 

 

 

 

 

 

but on a complex environment you might consider the use of the GPO tool by creating a dedicated gpo for it.

  1. Navigate to Computer Configuration, Policies, Administrative Templates, Network, Network Connections, Windows Firewall, Domain Profile.
  2. Double-click Windows Firewall: Allow inbound Remote Desktop exception.

there’s also another way to enable RDP on remote or local Computer  / Servers via Powershell ,using the WMI

with this line you can get the details of the Terminal feature status –

Note ! in order to query servers on your network with WMI ,you must enable it via firewall/gpo.

if the status of the value “AllowTSConnections” is 0 ,then the RDP feature is disabled.

to change it you’ll need to run the following line –

to make it even more simple iv’e created a function that will check the status of the Terminal Server Settings on a Remote or local server ,it’ll show you the status and

it can also change it by typing “Enable”

Enable_RDP_via_PS

 

 

 

Enjoy !

 

(Visited 3,002 times, 4 visits today)

One thought on “enable RDP from Powershell

  1. Hi, thank you for this great article!
    i have a couple of questions if i may –
    1. what is the difference between
    $RDPStatus.SetAllowTsConnections(1,1)
    and $RDPStatus.SessionBrokerDrainMode = 0 ?
    2. when i change drain mode using wmi – it does not reflect in the server manager… do you have this issue as well?
    thanks again,
    Sean

Leave a Reply