Windows server 2019 / Remote Desktop Gateway - cannot change tcp port

%3CLINGO-SUB%20id%3D%22lingo-sub-687096%22%20slang%3D%22en-US%22%3EWindows%20server%202019%20%2F%20Remote%20Desktop%20Gateway%20-%20cannot%20change%20tcp%20port%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-687096%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3CBR%20%2F%3EWe've%20tried%20this%20on%202%20different%20Windows%202019%20installs%20(fully%20updated)%20%3A%20with%20Remote%20Desktop%20Gateway%20feature%20enabled.%20Using%20the%20RD%20Gateway%20manager%2C%20in%20Transport%20Settings%2C%20we%20try%20to%20change%20the%20default%20port%20number%20from%20default%20TCP%20443%20to%20something%20else%2C%20but%20we%20get%20the%20following%20error%20message%20%3A%20%22%3CSPAN%3EThe%20following%20error(s)%20occurred%3A%20Unable%20to%20set%20transport%20settings%22%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EI've%20seen%20here%20and%20there%20some%20other%20people%20had%20the%20same%20problem%2C%20but%20I%20couldn't%20find%20any%20helpful%20solution...%26nbsp%3B%3CBR%20%2F%3EAny%20suggestion%20%3F%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-687096%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EWindows%20Server%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-693346%22%20slang%3D%22en-US%22%3ERe%3A%20Windows%20server%202019%20%2F%20Remote%20Desktop%20Gateway%20-%20cannot%20change%20tcp%20port%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-693346%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F123931%22%20target%3D%22_blank%22%3E%40Thomas%20Lecroart%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20run%20the%20following%20commands%20in%20an%20administrator%20powershell%20prompt%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Import-Module%20RemoteDesktop%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Set-RDSessionCollectionConfiguration%20-CollectionName%20%22YourCollectionName%22-CustomRdpProperty%20%22gatewayserver%3As%3Ayourgateway.domain.com%3ACustomPortYouWant%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegards%3C%2FP%3E%3CP%3EBM%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1477469%22%20slang%3D%22en-US%22%3ERe%3A%20Windows%20server%202019%20%2F%20Remote%20Desktop%20Gateway%20-%20cannot%20change%20tcp%20port%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1477469%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F123931%22%20target%3D%22_blank%22%3E%40Thomas%20Lecroart%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20problem%20took%20me%20way%20more%20time%20than%20it%20should%20have.%20Here%20is%20the%20complete%20solution%20%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAdd%20Inbound%20Firewall%20rule%20for%20YourCustomPortValue%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegedit%3C%2FP%3E%3CP%3E%5BHKLM%5CSOFTWARE%5CMicrosoft%5CWindows%20NT%5CCurrentVersion%5CTerminalServerGateway%5CConfig%5CCore%5D%3C%2FP%3E%3CP%3EIsUdpEnabled%20REG_DWORD%200%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECmd%3C%2FP%3E%3CP%3Enet%20stop%20tsgateway%20%26amp%3B%26amp%3B%20net%20start%20tsgateway%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegedit%26nbsp%3B%3C%2FP%3E%3CP%3E%5BHKLM%5CSOFTWARE%5CMicrosoft%5CWindows%20NT%5CCurrentVersion%5CTerminalServerGateway%5CConfig%5CCore%5D%3C%2FP%3E%3CP%3EHttpsPort%20REG_DWORD%20(YourCustomPortValue)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECmd%3C%2FP%3E%3CP%3Enet%20stop%20tsgateway%20%26amp%3B%26amp%3B%20net%20start%20tsgateway%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETrying%20to%20do%20both%20registry%20changes%20at%20once%20will%20result%20in%20the%20tsgateway%20service%20to%20fail%20with%20a%20warning.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor

Hi,
We've tried this on 2 different Windows 2019 installs (fully updated) : with Remote Desktop Gateway feature enabled. Using the RD Gateway manager, in Transport Settings, we try to change the default port number from default TCP 443 to something else, but we get the following error message : "The following error(s) occurred: Unable to set transport settings"

I've seen here and there some other people had the same problem, but I couldn't find any helpful solution... 
Any suggestion ?

2 Replies
Highlighted

@Thomas Lecroart 

Please run the following commands in an administrator powershell prompt:

                Import-Module RemoteDesktop

                Set-RDSessionCollectionConfiguration -CollectionName "YourCollectionName"-CustomRdpProperty "gatewayserver:s:yourgateway.domain.com:CustomPortYouWant"

 

Regards

BM

Highlighted

@Thomas Lecroart 

This problem took me way more time than it should have. Here is the complete solution :

 

Add Inbound Firewall rule for YourCustomPortValue

 

Regedit

[HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\TerminalServerGateway\Config\Core]

IsUdpEnabled REG_DWORD 0

 

Cmd

net stop tsgateway && net start tsgateway

 

Regedit 

[HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\TerminalServerGateway\Config\Core]

HttpsPort REG_DWORD (YourCustomPortValue)

 

Cmd

net stop tsgateway && net start tsgateway

 

Trying to do both registry changes at once will result in the tsgateway service to fail with a warning.