Windows OS Hub
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server 2025
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
    • Proxmox
  • PowerShell
  • Linux
  • Home
  • About

Windows OS Hub

  • Windows
    • Windows 11
    • Windows 10
    • Windows Server 2025
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
    • Proxmox
  • PowerShell
  • Linux

 Windows OS Hub / Windows Server 2019 / How to Remove RD Session Host from Remote Desktop Services Deployment

June 8, 2023

How to Remove RD Session Host from Remote Desktop Services Deployment

To remove an RSDH host from a Remote Desktop Services session collection/farm, you can use the Server Manager graphical console or the Remove-RDSessionHost PowerShell cmdlet.

You can use the following PowerShell command if you want to remove an online RD Session host from a session collection on an RDS farm:

Remove-RDSessionHost -SessionHost @("rdsh2.woshub.com") -ConnectionBroker rdcb.woshub.com –verbose

VERBOSE: The specified RD Session Host server will be removed from the session collection.

If the RDSH server you want to remove is offline (dead/failed host when you can’t boot Windows, or the server hardware is damaged), you will receive the following error when trying to remove it from your RDS deployment:

WARNING: Unable to cleanup the RD Session Host server rdsh1.

Remove-RDSessionHost - Unable to cleanup the RD Session Host server

If you try to remove such a server running Remote Desktop Services Host role from an RDS deployment using the Server Manager, you will see this error:

Could not remove the configuration. Object reference not set to an instance of an object.

remote desktop host role - Could not remove the configuration. Object reference not set to an instance of an object.

Also, you can’t manage your RDS farm through Server Manager because after removing the RDSH host from the console, you’ll see the following warning:

The following servers in this deployment are not part of the server pool:
rdsh2.woshub.com
The servers must be added to the server pool.

To correctly remove a failed RDS host you will not return to your farm, you have to remove its metadata from the RD Connection Broker (RDCB) database.

To do it, connect to the RDCB database using SQL Management Studio.

  • If you are using a local Remote Desktop Connection Broker database based on Windows Internal Database (WID), use the following connection string to connect to the SQL instance: \\.\pipe\MICROSOFT##WID\tsql\query
  • If your RDCB database is running on a SQL Server or in a SQL Server Always On High Availability Group (if you are using a high-availability RD Connection Broker role), connect to the appropriate SQL Server Listener (you may get it using the command: Get-RDConnectionBrokerHighAvailability )

Run SQL Management Studio and connect to the database using an account with the local administrator privileges on the server.

connect rds database with SQL Management Studio

It is strongly recommended to backup the RD Connection Broker SQL database before making any changes.

Expand the RDCms database and look for the following tables containing entries about the RDS farm hosts:

  • rds.Server – a full list of servers in the Remote Desktop Services farm
  • rds.RoleRdsh – a list of servers with the RD Session Host role
  • rds.RoleRdcb — Connection Broker
  • rds.RoleRdls — RDS License Serversr
  • rds.RoleRdvh — Virtualization Hosts
  • rds.RoleRdwa — Web Access Hosts

In our case, only the RDSH role is running on the server, which means it is enough to delete its entries from the rds.Server and rds.RoleRdsh tables.

Look in the table for the ID of the RDSH server that you want to remove from the RDS deployment. In my example, it is ID 3.

RD configuration database

Use the following T-SQL query to remove the RDSH records from both tables of the Connection Broker database:

use RDCms;
delete from rds.RoleRdsh where ServerID = '3';
delete from rds.Server where Id = '3';

remove remote desktop server from RD database with T-sql

You don’t need to put other RDSH hosts in the drain mode.

Close the database and restart the Server Manager console. Open the RDS console, update the configuration, and make sure that the removed server no longer appears in the list of available RDS hosts.

removing dead host from rds deployment

You can also make sure that there is no removed server in the RDS farm using this command:

Get-RDServer

If you want to migrate the RD Connection Broker or RD Web Access roles to another server, use this guide.
1 comment
5
Facebook Twitter Google + Pinterest
Windows Server 2016Windows Server 2019
previous post
How to Enable and Configure SSH Server on Windows with OpenSSH
next post
Install Windows Subsystem for Linux (WSL 2) on Windows 10/11

Related Reading

How to Repair EFI/GPT Bootloader on Windows 10...

March 16, 2024

How to Restore Deleted EFI System Partition in...

March 11, 2024

How to Run Program without Admin Privileges and...

June 8, 2023

Fix: Remote Desktop Licensing Mode is not Configured

August 24, 2023

How to Install Remote Server Administration Tools (RSAT)...

March 17, 2024

Refresh AD Groups Membership without Reboot/Logoff

March 15, 2024

How to Repair Windows Boot Manager, BCD and...

March 11, 2024

Fix: BSOD Error 0x0000007B (INACCESSABLE_BOOT_DEVICE) on Windows

March 17, 2024

1 comment

Francesco December 28, 2022 - 10:13 am

I found at this link (https://learn.microsoft.com/en-us/answers/questions/348334/remove-server-from-rds-deployment-after-decommissi.html?sort=votes) a trick to avoid installing SSMS and having to manually delete rows from the tables. Simply recreate the computer object in Active Directory, or restore it from the Active Directory Recycle Bin, and run the Remove-RDServer cmd let. It worked for me.

Reply

Leave a Comment Cancel Reply

join us telegram channel https://t.me/woshub
Join WindowsHub Telegram channel to get the latest updates!

Recent Posts

  • Encrypt Any Client-Server App Traffic on Windows with Stunnel

    June 12, 2025
  • Failed to Open the Group Policy Object on a Computer

    June 2, 2025
  • Remote Desktop Printing with RD Easy Print Redirection

    June 2, 2025
  • Disable the Lock Screen Widgets in Windows 11

    May 26, 2025
  • Configuring Windows Protected Print Mode (WPP)

    May 19, 2025
  • Map a Network Drive over SSH (SSHFS) in Windows

    May 13, 2025
  • Configure NTP Time Source for Active Directory Domain

    May 6, 2025
  • Cannot Install Network Adapter Drivers on Windows Server

    April 29, 2025
  • Change BIOS from Legacy to UEFI without Reinstalling Windows

    April 21, 2025
  • How to Prefer IPv4 over IPv6 in Windows Networks

    April 9, 2025

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • How to Downgrade Windows Server Edition or License
  • Fix: Remote Desktop Licensing Mode is not Configured
  • How to Convert (Upgrade) Windows Server Evaluation to Full Version
  • Configuring Port Forwarding in Windows
  • Allow Non-admin Users RDP Access to Windows Server
  • Tracking and Analyzing Remote Desktop Connection Logs in Windows
  • Fixing “Winload.efi is Missing or Contains Errors” in Windows 10
Footer Logo

@2014 - 2024 - Windows OS Hub. All about operating systems for sysadmins


Back To Top