How to setup mstsc in windows allowing from firewall rules using cmd #WindowsCMD #RemoteDesktop #MSTSC #FirewallRules #WindowsFirewall #RDP #EnableRDP #CommandLine #SystemAdministration #WindowsServer #windows #rdp #mstsc #remotedesktop #remotedesktopconnection

 #WindowsCMD

#RemoteDesktop

#MSTSC

#FirewallRules

#WindowsFirewall

#RDP

#EnableRDP

#CommandLine

#SystemAdministration

#WindowsServer

To set up **Remote Desktop (mstsc)** access on a Windows machine and allow it through the **Windows Firewall** using **Command Prompt (CMD)**, follow these steps:


---


### ✅ **1. Enable Remote Desktop via CMD**


```cmd

reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f

```


This enables Remote Desktop by setting `fDenyTSConnections` to `0`.


---


### ✅ **2. Allow Remote Desktop through Windows Firewall**


```cmd

netsh advfirewall firewall set rule group="remote desktop" new enable=Yes

```


This command enables all rules in the **"Remote Desktop"** firewall rule group.


---


### ✅ **3. (Optional) Check if Firewall Rule is Enabled**


To check the current status of the Remote Desktop firewall rules:


```cmd

netsh advfirewall firewall show rule name="Remote Desktop"

```


---


### ✅ **4. (Optional) Add a Specific Port (TCP 3389) to Firewall**


If you need to manually allow port 3389:


```cmd

netsh advfirewall firewall add rule name="Allow RDP Port 3389" dir=in action=allow protocol=TCP localport=3389

```


---


### ⚠️ **Important Notes**


- The user you're connecting to must have a **password** set.

    

- Remote Desktop access is only available on **Professional, Enterprise, or Education** editions of Windows — not Home edition.

    

- Make sure the PC is not asleep or shut down.

    


---


Let me know if you want a **PowerShell version** or want to **reverse these steps** later!

Comments