RDS client cannot connect to RD Session Host server after the server IP address is changed

Important This article contains information about how to modify the registry. Make sure that you back up the registry before you modify it. Make sure that you know how to restore the registry if a problem occurs. For more information about how to back up, restore, and modify the registry, click the following article number to view the article in the Microsoft Knowledge Base:
322756 How to back up and restore the registry in Windows


Considering the following scenario:
  • You set up a standard deployment of Remote Desktop Services (RDS) in Windows Server 2012. The deployment contains Remote Desktop (RD) Session Host servers, an RD Connection Broker server, and an RD Web Access server.
  • You create a session collection that can be accessed by RDS clients through the RD Web Access website.
  • The IP addresses of all RD Session Host servers in the session collection are changed.
In this scenario, the RDS clients cannot connect to the session collection, and you receive the following error message during the connection:
Your credentials did not work.


This problem occurs because of an obsolete registry entry in the following subkey:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\ClusterSettings
The SessionDirectoryRedirectionIP registry entry stores the IP address of an RD Session Host server that was assigned when the RDS deployment was created. Although the IP address of the RD Session Host server is changed, the IP address in the RD Connection Broker setting is not updated. Therefore, RDS clients cannot connect to the session collection.


Warning Serious problems might occur if you modify the registry incorrectly by using Registry Editor or by using another method. These problems might require that you reinstall the operating system. Microsoft cannot guarantee that these problems can be solved. Modify the registry at your own risk.

To resolve this problem, delete the SessionDirectoryRedirectionIP registry entry of the following registry subkey from each RD Session Host server in the session collection:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\ClusterSettings
Alternatively, you can run the following PowerShell script. This script deletes the registry entry from every RD Session Host server in the deployment.
Import-Module RemoteDesktop

# Delete the Registry Key for all machine name specified in $RemoteMachine
Function DeleteRegistryKey($RemoteMachine)
$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $RemoteMachine)

# connect to the needed key :
$regKey= $reg.OpenSubKey("System\\CurrentControlSet\\Control\\Terminal Server\\ClusterSettings", $true )

# and delete the SessionDirectoryRedirectionIP subkey, if it exists
foreach ($key in $regKey.GetValueNames())
if ($key -eq "SessionDirectoryRedirectionIP")
Write-Host "Machine : "$RemoteMachine

# Get the list of collections on the machine
$RdSessionCollections = Get-RDSessionCollection

if ($RdSessioncollections -eq $null)
Write-Host "No RDSH Session Collections"

foreach ($SessionCollection in $RdSessionCollections)
Write-Host "Collection Name : " $SessionCollection.CollectionName

# get list of RDSH Servers in the collection
$RdSessionHosts = Get-SessionHost -CollectionName $SessionCollection.CollectionName
foreach ($SessionHost in $RdSessionHosts)
Write-Host "SessionHost : "$SessionHost.SessionHost

# Delete the regkey on this server

Article ID: 2844958 - Last Review: May 9, 2013 - Revision: 1