This is in addition to the “Customize RD Web Access 2012 R2” series. You can start this series here in case you want to read up or see what else I customized in this series.
This post is inspired by comments in the series, in which readers asked if it was possible to hide RemoteApp programs in the main page, whilst still retaining them in the WebFeed so they show up in RemoteApp and Desktop connections (RADC).
I did a little digging in the code and found a way to accomplish this.
I’ve used setups from different guides you can find on this blog. I’ve created a Remote Desktop Services environment in which I have created two collections. One which holds a full desktop, and one which will look familiar, which holds several RemoteApps.
If I modify the published RemoteApp “Paint” to not show up in RD Web Access, by going to the RemoteApps collection and editing the properties for “Paint”:
It will indeed not show up in the RD Web Acces interface, but it will also disappear from the RADC program:
Granted, it will not disappear immediately, but on the next update interval or when you reconnect, it will be gone.
So, in order to hide certain applications from the RD Web Access interface and still be able to access them from the WebFeed, we’ll need to edit some code again.
The files that make up RD Web Access are in C:\Windows\Web\RDWeb\Pages so make a copy of that folder structure just to make sure we have a backup should we break something.
The code that handles what resources to display in the RD Web Access interface is in the Site.xsl file so open that in an editor.
Find line 721, you’ll find the XSL Template for handling RDP Resources:
This template actually inserts a <div></div> structure for each item.
The idea is to modify this template to only create this structure if it is for an item we wish to show.
<xsl:variable name="currentTitle" select="@Title"/> <xsl:variable name="hideApps" select="''"/> <xsl:choose> <xsl:when test="not(contains($hideApps,$currentTitle))">
This modification takes a variable “hideApps” and checks if the title for the item to display is somewhere in this variable. If it’s not, it will show the item. If the title for the current item is one of the items to hide, it skips the creation of the <div></div> structure and so hiding the item entirely.
To test this add “Paint” to the “hideApps” variable on line 723:
Disconnect the RADC and reconnect the WebFeed again and you’ll see you’ll still be able to access “Paint” from there.
If you want to hide multiple items you’ll need to make sure they are separated with a character you don’t use in the display names for your RemoteApps or Desktops.
The name of the item you want to hide must be the exact name as it would show when it is visible, and yes, that means these are case sensitive.
So in this case, if I wanted to hide both “Paint” and “WordPad”, I’d make line 723 look like this:
And that’s it. Improvements to this method? If you’d want to do this really fancy you could dive into IIS Application Settings and look into ways of using those in the xsl file and make editing the apps to hide a little more user friendly.
Till next time,