Friday, January 25, 2013

Adding custom RDP properties in Windows Server 2012 RDS/VDI environments

If you’re familiar with Remote Desktop Services in Windows Server 2008(R2) you’re probably familiar with the Remote App manager. This MMC snap-in was available on servers running the RD Session Host role and could be used to publish Remote Apps. As you might know by now, with Windows Server 2012 many of the MMC snap-ins have been deprecated and configuration of those features is now performed centrally using the Remote Desktop Management Service (RDMS) as part of the new Server Manager console. For more details on that also see RDMS on Windows Server 2012: The Where, the Why and the How..

Part of this Remote App manager in Windows Server 2008 R2 was the ability to set Deployment Settings, for example the Custom RDP Settings. Custom RDP settings can be used to further customize the users session, for example by settings specific redirection options or enabling Smart Sizing.

With Windows Server 2008(R2) setting these Custom RDP settings could be modified by using the GUI.

image

With Windows Server 2012 there is no option to set this in the RDMS Server Manager GUI. In order to add custom RDP properties we need to use the RemoteDesktop PowerShell module

The command to do this is Set-RDSessionCollectionConfiguration

For example, if we want to remove the connectionbar we could run the following command:

Set-RDSessionCollectionConfiguration –CollectionName QuickSessionCollection "displayconnectionbar:i:0"

image

These settings are are stored in the registry of the RD Connection Broker(s) that are part of the Session Collections deployment.

image

Do note that if we wanted to add an additional custom RDP property we would have to specify all the custom RDP properties in one command. For example if we would add an additional custom RDP property to map the local C: drive and run

Set-RDSessionCollectionConfiguration –CollectionName QuickSessionCollection "drivestoredirect:s:C:"

That would overwrite the previously added custom RDP property.

image

We obviously have to add all the custom RDP properties at once. To make this work we need to add a linefeed character (which is: `n) between the options otherwise it won’t be applied properly. The command would look like this:

Set-RDSessionCollectionConfiguration –CollectionName QuickSessionCollection "drivestoredirect:s:C: `n displayconnectionbar:i:0"

This will result in a published desktop with the following properties

image

As you might know the RD Connection Broker settings (as well as other RDMS settings) are stored in a database. Without running in RD Connection Broker High Availability (HA) mode, this is a SQL Express database running on the RD Connection Broker itself, and when running in HA mode, the database is moved to a central SQL Server instance.

Since the SQL database is the central place to store configuration we would expect the Custom RDP property to also be stored in this database. I’ve done some searching inside the RDMS database, and it appears that the Custom RDP property that we set using PowerShell is not stored there. Inside the table called PoolProperty, there is a CustomRDPSettings but that only contains the setting that is there by default, not our added properties.

image

There also is a value called CustomRdpSettings inside the table RdpFileInfo, but that table does not seem to hold any records at all.

image

So as it now seems the properties are only stored inside the registry of the RD Connection Broker.

Now consider the following scenario; we define the Custom RDP properties as shown above and after that add an additional RD Connection Broker. Would our added properties make it to the additional RD Connection Brokers registry?
I have tried this in my lab and it seems that this settings does not make it to the newly added RD Connection Broker!

First RD Connection Broker server Added RD Connection Broker server

image

image

The solution here is to run the PowerShell command again so that the configuration on the 2 RD Connection Broker is in sync again.

This raises another question, what if we would add a additional Custom RDP Property in a environment that is already in HA mode, but with 1 of the RD Connection Broker servers not being available? We can simulate this by disconnecting the network adapter of the 2nd RD Connection Broker and then try to run the PowerShell command again.

image

The command now raises an error “Unable to set Custom RDP Properties for collection Quick Session Collection because one or more RD Connection broker servers are unreachable or misconfigured”. Which is good! Because this way the RD Connection Broker configuration stays consistent.

Other properties configured in the RDMS GUI can be configured while a RD Connection broker in your HA farm is offline. For example we would be able to publish a Remote App. When the 2nd RD Connection Broker comes online again it’s triggered to sync the configuration, which can also be forced by restarting the “Remote Desktop management” service. The fact that you cannot change the Custom RDP Properties with a RD Connection Broker being offline seems to proof that this setting is not stored in the RDMS database but only in the registry.

1 comment:

  1. It is possible to made it for Virtual Desktop Pool? (VDI)

    ReplyDelete