How to Change RDP Port on Windows Server with One-Click Script Print

  • 0

This article explains how to securely change the Remote Desktop Protocol (RDP) port on your Windows VPS or dedicated server using our one-click PowerShell script. This is a simple and effective way to reduce brute-force attacks targeting the default port (3389).

 

Important:

Changing the RDP port can prevent remote access if misconfigured. Make sure you have alternate console access (like VNC or IPMI) before proceeding.

 


Features of the Script

  • Automatically changes the RDP port of your Windows server.

  • Opens the new port in Windows Firewall.

  • Optionally enables RDP if it is currently disabled.

  • Displays connection details after the change.


How to Use the Script

  1. Login to your Windows Server using RDP or console access.

  2. Open PowerShell as Administrator.

  3. Run the script using the following command:

 

irm https://raw.githubusercontent.com/hosteons/Windows-RDP-Port-Changer-Script/main/rdp_port_changer.ps1 | iex

 

  1. You will be prompted to enter a new RDP port.

  2. The script will:

     

    • Update the registry with the new port

    • Configure the firewall

    • Optionally enable RDP if disabled

     

  3. Once completed, it will display your new RDP connection details.

 

 


 

Notes

  • Default RDP port is 3389. Changing this can reduce unauthorized access attempts.

  • Be cautious when using ports under 1024, as they may conflict with existing services.

  • Ensure your new port is allowed by your VPS provider or hosting firewall.

 

 


 

GitHub Repository

 

 

You can view and download the full source code here:

Windows RDP Port Changer Script on GitHub


Was this answer helpful?

« Back