Change Remote Desktop Gateway Port
Change the Remote Desktop Gateway port.
June 9, 2014
![QA QA](https://eu-images.contentstack.com/v3/assets/blt07f68461ccd75245/bltc3f14b5915c96ab0/661cf175bdb280509029210a/qawebartgreen_0_3.jpg?width=1280&auto=webp&quality=95&format=jpg&disable=upscale)
Q: Can I change the port that Remote Desktop Gateway uses?
A: By default, the Remote Desktop (RD) Gateway component that encapsulates RDP in HTTPS packets listens on port 443 (for TCP) and port 3391 (for UDP). You can use the RD Gateway Manager utility to change this as follows:
Right-click the RD Gateway server name in the navigation pane and select Properties.
Select the Transport Settings tab.
Modify the HTTP and/or UDP port number. Set the custom port value to the same port if you change them, because there's no way to do so in the client.
Specify different custom ports for UDP versus TCP, then click OK.
Note that two firewall exceptions are enabled by default; however, they use the default ports, so you'll need to add your own firewall exceptions for TCP and UDP for the custom port you selected.
When you connect from a client, you need to add the custom port to the end of the gateway server name, preceded by a colon (:); for example, mygateway.domain.com:9999. Note that this is only an RDP client that supports RDP 8.0 or later.
If you're using RemoteApp, you need to manually update the gateway in the RDP file with the correct port because you can't change it via Server Manager to specify a custom port for the gateway. You can modify the port used for the gateway by connecting to the Remote Desktop Session Host and navigating to HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionTerminal ServerCentralPublishedResourcesPublishedFarmsDeploymentSettings, then editing the DeploymentRDPSettings value to add the port to the gatewayhostname:s:mygateway.com:9999 part of the string. Note that you must set this before you publish any applications. A nicer way is to use PowerShell:
Set-RDSessionCollectionConfiguration –CollectionName "Your Collection" -CustomRdpProperty "gatewayhostname:s::" -ConnectionBroker
About the Author
You May Also Like