Command to enable Remote Desktop using CMD

Vikas Vijay Bhadvalkar 25 Reputation points
2023-06-28T20:38:18.7733333+00:00

Command to enable Remote Desktop using CMD batch

Windows for business | Windows Server | User experience | Other

Answer accepted by question author
Anonymous
2023-06-28T20:52:38.54+00:00

You'll need to start Remote Desktop Services (TermService) service, then add the firewall rule to allow inbound connections on port 3389, and finally add the users to the Remote Desktop Users

--please don't forget to upvote and Accept as answer if the reply is helpful--

Was this answer helpful?

2 people found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Matthew Bechtol 506 Reputation points
    2023-06-28T20:48:51.9266667+00:00
    :: Enable remote access.
    
    reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
    
    :: allow through firewall.
    
    netsh advfirewall firewall set rule group="remote desktop" new enable=Yes
    

    Was this answer helpful?

    10+ people found this answer helpful.

  2. Nick_Tyks 85 Reputation points
    2026-07-23T07:20:14.41+00:00

    I instead used PowerShell a while back, since the CMD batch thing didn't work for me at the time. Not totally sure why, maybe a permissions issue or the reg add command just failing silently depending on the Windows build. Running the same commands in PowerShell as admin worked fine though, it tends to handle registry and firewall stuff more reliably than CMD. Other times I just use HelpWire if I need a quick remote session without messing with RDP at all.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.