Close Menu
    Facebook X (Twitter) Instagram
    Prajwal.orgPrajwal.org
    • Home
    • SCCM

      SCCM 2503 Upgrade New Features and Hotfixes

      April 30, 2025

      Create a Device Collection for SCCM 2409 Clients

      February 27, 2025

      Device Collection for SCCM 2403 Clients

      January 22, 2025

      SCCM 2403 Hotfixes, Upgrade and New Features

      January 21, 2025

      ConfigMgr 2401 Technical Preview Released

      January 22, 2025
    • Intune

      New Features in Intune 2502 release (February 2025)

      February 27, 2025

      Intune Service Release 2406 New Features (June 2024)

      June 23, 2024

      Microsoft Intune 2405 New Features (May 2024)

      May 29, 2024

      How to Disable Android Enterprise system app in Intune

      May 22, 2024

      Intune ends support for Android device administrator

      January 22, 2025
    • Windows 11

      How to Install WSUS Console on Windows 11

      January 22, 2025

      How to enable memory integrity using Group Policy

      January 22, 2025

      Uninstall Mail and Calendar Apps using PowerShell

      January 22, 2025

      How to Create Batch File to Delete Temp Files

      January 22, 2025

      How to Change RDP Port using PowerShell

      January 22, 2025
    • Contact
    Prajwal.orgPrajwal.org
    Home » How to Change RDP Port using PowerShell
    Windows 11

    How to Change RDP Port using PowerShell

    Learn how to change RDP port via PowerShell in Windows server and Windows 11
    January 22, 20256,727 Views

    When you connect to a computer or a server through the Remote Desktop client, the Remote Desktop feature on your computer “hears” the connection request through a defined listening port (3389 by default).

    Some organizations prefer to change the default RDP port (3389) on Windows servers to a custom port to make it more challenging for potential attackers to gain unauthorized access.

    Fortunately, with the power of PowerShell, changing the RDP port becomes a straightforward process. By executing a single command in PowerShell, you can customize your RDP port to suit your specific requirements.

    You can also change RDP port number using SCCM or manually by editing the registry. However, changing the RDP listening port on a Windows server using PowerShell is the most convenient and secure method.

    PowerShell Script to Change RDP Port

    The following PowerShell script allows you to change the RDP port from the default 3389 to a custom port. Before running the below PS script, you’ll need to specify the custom port for RDP.

    To run the below script, copy and paste it into a text editor and change the name to something like changeRDPport.ps1. On your Windows Server or Windows 11, launch the Windows PowerShell as an administrator and run the below script.

    $portvalue = 3390
    
    Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "PortNumber" -Value $portvalue 
    
    New-NetFirewallRule -DisplayName 'RDPPORTLatest-TCP-In' -Profile 'Public' -Direction Inbound -Action Allow -Protocol TCP -LocalPort $portvalue 
    New-NetFirewallRule -DisplayName 'RDPPORTLatest-UDP-In' -Profile 'Public' -Direction Inbound -Action Allow -Protocol UDP -LocalPort $portvalue

    Verifying the new RDP Port

    After you have modified the RDP port number using the above script, you can run a simple PowerShell command to verify the RDP listening port. You can also use CMPivot query to quickly determine the RDP port of a client computer or Windows server.

    Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "PortNumber"
    Verifying the new RDP Port | Change RDP Port
    Verifying the new RDP Port | Change RDP Port
    Share. Facebook Twitter Pinterest LinkedIn Email
    Previous ArticleHow to Connect to SCCM using PowerShell
    Next Article How to Create Batch File to Delete Temp Files

    Related Posts

    Windows 11

    How to Install WSUS Console on Windows 11

    January 22, 2025
    Windows 11

    How to enable memory integrity using Group Policy

    January 22, 2025
    Windows 10

    Uninstall Mail and Calendar Apps using PowerShell

    January 22, 2025
    Latest Guides

    SCCM 2503 Upgrade New Features and Hotfixes

    New Features in Intune 2502 release (February 2025)

    Create a Device Collection for SCCM 2409 Clients

    Intune Service Release 2406 New Features (June 2024)

    Updated:June 23, 2024
    Popular Guides

    Uninstall Snipping Tool using PowerShell

    Updated:January 22, 2025

    How to Manually Install SCCM Client Agent

    Updated:January 22, 2025

    How to Create Batch File to Delete Temp Files

    Updated:January 22, 2025

    Disable Driver Signature Enforcement using CMD Prompt

    Updated:January 22, 2025
    Trending Posts

    How to Install or Enable Telnet in Windows 10

    Updated:January 22, 2025

    How To Add Google Analytics To GeneratePress

    Updated:February 14, 2024

    ConfigMgr Updates Deployment Error 0x80070070

    Updated:January 22, 2025

    How to Uninstall OneDrive on Windows 11

    Updated:January 22, 2025
    © 2025 Prajwal.org | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.