Remote Desktop Services: Can’t Remove Dead Server

KB ID 0001415

Problem

I was doing some RDS work for a client today, and it would seem that at some time in the past their RDS Licensing server had died, it had been replaced, and everything was working OK. But when I was adding roles to the new servers, this kept popping up;

Add RD Server

The following server in this deployment are not part of the server pool
1. Server-Name
The servers must be added to the server pool.

I could have ignored the error and finished the job, but things like this remaining ‘unfinished’ really wind me up. So I thought I’d sort it out.

Solution

At first I thought I could just dive into either ADSIEdit or ‘AD Sites And Services’, make a quick change and everything would be fixed. That revealed that the site licence server was set to a server that also didn’t exist! (So I fixed that, still the problem remained).

So if all else fails then use PowerShell right?

Remove-RDServer {Server-FQDN} {ROLE}


Cannot Delete RD Server

Error: Object Reference not set to an instance of an object

After some research I discovered that the RDS servers are stored in a database, (Windows Internal Database) on the connection broker(s). So you need to download the ‘SQL Management Studio’ software on your connection broker(s). Then ‘Run As’ administrator.

Run Management Studio As Administrator

Connect to, “\\.\pipe\MICROSOFT##WID\tsql\query

Under Databases you will find a database called RDCms  >Expand that, and drill down to the tables. Locate rds.server. Press the ‘Query’ button > Right click the rds.server table > List top 1000 rows.

Locate Dead RDS Server

Locate your ‘Dead’ server here you can see mine has an ‘Id’ of 3. Look in the following tables and make sure there are no references to Id 3. (I didn’t have any, my only reference was in the rds.server table.)

  • rds.RoleRdcb (Connection Broker)
  • rds.RoleRdls (License Server)
  • rds.RoleRdsh (Session Host)
  • rds.RoleRdvh (Virtualisation Host)
  • rds.RoleRdwa (Web Access Host)

In the bottom of the Query Section enter the following, (as applicable, i.e your column might be ServerId, and your server might be number 123)

use RDCms

delete from rds.server where Id=3

Delete Dead RDS Server

Press ‘Execute’, Close the SQL Manager, repeat on any remaining ‘Session Brokers’. Have a coffee, then try again, the problem should be resolved.

Related Articles, References, Credits, or External Links

NA

Author: PeteLong

Share This Post On

16 Comments

  1. Excellent, solved my problem. Thank you very much.

    Post a Reply
    • Wow!
      What a timesaver this article has been for me.

      I have a RDS ‘cluster’ with 4 server.
      2 of them I have removed from the remoteApp collection.
      And of course, I also removed them from AD
      Now later they were still showing up, only on the ‘Collections’ level.
      And exactly as in your case the error was ‘Object Reference Not Set’

      By following the steps as described above it worked to get them out.

      Thank you !

      Post a Reply
  2. This is great stuff! I used same method to REMOVE dead and long gone Connection Broker, and point the “setting” for primary one to the new one (server I edited the DB on).

    Thanks!

    Post a Reply
  3. Hi
    This is really helpful.. but I’m stuck.
    Although I can open the SSMS, see the DB and tables, all queries return empty tables.

    I’m stuck with 2 SH that are dead and gone and no way to access the RDS configuration.

    Any hint ?

    Thanks

    Fab

    Post a Reply
    • This sounds more like permissions? do you ‘run as’ administrator?

      Pete

      Post a Reply
      • I am having the ame problem as Fabian, yes I ran as administrator. But all tables are empty. I ran as local administrator and domain administrator. Any ideas?

        Post a Reply
      • I tried to do the same job, got an empty result in the SQL query.
        I was managing all RDS from the broker, Collection was working, I am sure that I am running from the broker.
        One of the server failed, can’t bring so I want to remove it.
        I did run as Administrator – SSMS, confirmed.
        Anything else to try?

        Post a Reply
  4. Thanks for the great writeup! Helped me out to fix this dumb issue… We had added a new host with the same name and somehow the entry was screwed up in the database.

    Post a Reply
  5. Great article, solved me a big headache with a customer today!!! Thanks alot!!

    Post a Reply
  6. Hi!

    Thanks so much.
    You helped me 😀

    Post a Reply
  7. works like a charm! Thanks again!

    Post a Reply
  8. This is the only solution that worked for me. Thank you.

    Post a Reply
  9. Great article, solved me a big headache today!!!
    Thank you. This is the only solution that worked even for me.

    Post a Reply
  10. What do you do if the Dead Server ID shows up in one of the additional tables too such as rds.RoleRdsh?

    Post a Reply

Leave a Reply to Oliver F. Cancel reply

Your email address will not be published. Required fields are marked *