Unable to remove deleted Session Hosts from RDS2012 Deployment

13 Jun

I’ve had a few issues with RDS in Server 2012, most of it because there is little to no documentation on a lot of the errors I’ve faced. Quite annoying when you jump on to Google and there is no answer available, anyway, I found some quite interesting stuff whilst trying to fix this particular issue, so read on…

I added a couple of Terminal Servers to my 2012 Broker to do some testing, but then didn’t remove them cleanly when they were no longer required, infact I just deleted the VM’s when I no longer needed them.

But then when opening Server Manager and heading to Remote Desktop Services I was told that it couldn’t load because some servers were missing, the ones I had just deleted – doh!

This was a bit of a problem as they weren’t around any more, so in a desperate act, I added a couple of fresh servers back to the domain, with the names of those that were deleted and at least then I could add these into server manager and access the Remote Desktop Services section.

This however left me with a server that I couldn’t get rid of.



When I tried to remove the RD Session Host server I received the error:

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


I googled this and came across somebody else facing the same issue (and somebody else here and here), but alas, no fix available.

So it was back to Google to find where RDS stored its configuration data in Server 2012, it must be somewhere right? I did an extensive search of the registry initially but this resulted in nothing.

Then I came across the ‘Windows Internal Database’ (mentioned here and here).

Firstly, download Microsoft SQL Server Management Studio, then run it as an administrator (If you don’t you will get a login authentication error when you try to connect)

Then connect to:


At which point you will see a database called ‘RDCms’:


Interesting eh? I looked at every table in there and found that this was the back end configuration for my RDS setup, so that answer to my problems must be in here.

Anyway when looking at the table rds.RoleRdsh (Remote Desktop Session Host) I found:


I also cross-referenced this entry to the table rds.Server:

And it looked to be my orphaned server, so I took a full backup of the RDCms database and then ran the following SQL:

use RDCms
delete from rds.RoleRdsh where ServerId = ‘1005’

This executed successfully and then when I loaded server manager my orphaned host server was now gone, yippee!


I also had an issue with a VM in a pool of desktops that I had renamed an I couldn’t delete, although when I went to take the screenshots to write this blog post the issue had disappeared and it let me delete it with no issues. If that issue occurs again, I’ll be sure to get screenshots and add it to this post.
Good luck!