In this post, you’ll learn how to use CMPivot query to find RDP port number using SCCM. The RDP port is 3389 by default, but you can use a CMPivot query to determine the port number if it has changed.
When you connect to a computer (either a Windows client or Windows 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). You can change that listening port on Windows computers by modifying the registry.
There are multiple ways to change the RDP port number on remote Windows computers, such as registry, PowerShell, or CMPivot. When you want to determine the RDP port that is configured on any given computer, you can use a CMPivot query because it is quick and accurate.
Use CMPivot Query to Find RDP Port Number
Perform the following steps to find the RDP port number using the CMPivot query in SCCM:
- Launch the ConfigMgr console and go to Assets and Compliance > Overview > Device Collections.
- Right-click on the device collection and select Start CMPivot.
- Run the below CMPivot query to find the RDP port of all the devices within the device collection.
Registry('HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp') | where Property == 'PortNumber'
In the CMPivot query output, the value field shows the RDP port number. There is an export option in the CMPivot query window where you can export the RDP port numbers of computers to an external file.