Terminal Services for Windows 2000, and Remote Desktop for Windows XP and Windows 2003, use TCP port 3389 for both inbound and outbound traffic. Under some conditions you may be forced to use another port for Terminal Services -- for instance, if you're dealing with a firewall or proxy that doesn't allow certain ports for security reasons.
Microsoft made some provisions to allow users to change the port for Terminal Services, although the company doesn't recommend it unless there is absolutely no other choice. To change the port used, you'll need to edit the Registry on the server and change the settings for the client connections.
To edit the server, open the Registry and navigate to HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp. Edit the DWORD value PortNumber and set it to the network port number you wish to use. The default is 00000D3D (hex), or 3389.
On the client side, open the Client Connection Manager and create a new connection to the server. (You won't be able to modify the port number yet.) Save the connection to a file, with a .CNS extension, and edit the file using a text editor. Locate the line that reads Server Port=3389 and edit it to match the new port used on the server. Save the file and reimport it into the Connection Manager to use it.
If you're using Remote Desktop (Windows XP, Windows 2003) to connect to the server, open the Remote Desktop Connection application and create a new connection to the server. Save the connection to a file, which should have an .RDP extension, and edit it using a text editor. At the top of the file add a line that reads server port:i:<portnumber>, where <portnumber> is the new port number to use. Save the file and double-click on it to launch the connection.
Note that if you are using the Terminal Server ActiveX client, it is hard-wired to use port 3389 and cannot be changed.
Serdar Yegulalp is the editor of the Windows 2000 Power Users Newsletter. Check out his Windows 2000 blog for his latest advice and musings on the world of Windows network administrators – please share your thoughts as well!
This was first published in July 2003