The Remote Desktop Protocol (RDP) is a widely used protocol that allows users to remotely connect to and control another computer over a network connection. In some cases, you may need to enable or disable RDP access to a computer through the Command Prompt.
To enable RDP through the Command Prompt, follow these steps:
- Open a Command Prompt window as an Administrator.
- Type the following command:
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
- Press Enter.
This will enable RDP on the local machine. If you want to enable RDP on a remote machine, you can use the PsExec
tool to run the command remotely:
psexec \\RemoteMachine reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
To disable RDP through the Command Prompt, follow these steps:
- Open a Command Prompt window as an Administrator.
- Type the following command:
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 1 /f
- Press Enter.
This will disable RDP on the local machine. If you want to disable RDP on a remote machine, you can use the PsExec
tool to run the command remotely:
psexec \\RemoteMachine reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 1 /f
To enable Remote Desktop in Windows Firewall:
To allow RDP in Windows Firewall, run the below command:
netsh advfirewall firewall set rule group="remote desktop" new enable=Yes
To disable Remote Desktop in the Windows Firewall:
To block RDP in Windows Firewall, run the below command:
netsh advfirewall firewall set rule group="remote desktop" new enable=No
Whether you need to enable RDP access to a local or remote machine, these steps should help you achieve your goals.