How to generate a Remote Desktop Manager (RDMan) group XML for your infrastructure with PowerShell

I thought that RDMan, aka Remote Desktop Connection Manager, fitted perfectly in “A BLAST FROM THE PAST” category of software used back in the day by every System Engineer working on Windows Systems. I was wrong. Believe it or not, it is still strong today!

When you need to manage multiple servers/workstation remotely via RDP(Remote Desktop Protocol) it’s for most professionals the obvious choice. The GUI of the application is straightforward and in most cases or scenarios it’s fit for purpose.

Today, most of the action on Windows Administration side is or it should be on Windows Admin Center (WAC), which is my opinion, it is a way more efficient and flexible choice for System Engineers. But comparing WAC with RDMan is not fair, like comparing apples with pears.

I’ve talked about WAC in these articles :

Remote Desktop Connection Manager

RDCMan manages multiple remote desktop connections. It is useful for managing server labs or large server farms where you need regular access to each machine such as automated checkin systems and data centers. It is similar to the built-in MMC Remote Desktops snap-in, but more flexible. The RDCMan 2.7 version is a major feature release. New features include: – Virtual machine connect-to-console support – Smart groups – Support for credential encryption with certificates – Windows 8 remote action support – Support for Windows 8, Windows 8.1 / Windows Server 2012, Windows Server 2012 R2

RDMAN https://www.microsoft.com/en-au/download/details.aspx?id=44989

This is how it looks like:

Remote desktop manager stores Remote Desktop groups settings into RDG files.

RDG Files

The RDG file is in an XML format and looks like this :

There are ways that are quick and dirty and in general, you need to avoid. One of them, for example, is re-invent the wheel, building your own template generator instead of using a parser or a built-in library that manipulates XML. Please don’t!

One thing is being tempted, another thing is starting to code without even thinking of the end goal. That’s just wrong. Period.

In this article, I’ll show how to generate an RDG file with a little bit of help offered by PowerShell and the .NET Framework.

First of all, we need to gather a list of servers in our environment/infrastructure. The content can be stored or imported from a file txt/csv or even AD. Most probably AD is your primary Source of Truth in our company for the windows environment.  Feel free to adapt the script to your needs.

We can filter AD Computer by OU(Organisational Unit), by OperatingSystem, Name, TAG, etc..

The following step is creating an XML Template. The benefits of using an XML file as an input template is that we can customize later on or having multiple versions without changing (with reasonable and valid settings for RDMan) our code/script, but just re-run it will give us a different output.

Powershell Script

If we want to query AD we need the ActiveDirectory module. For testing purpose, I’ve commented out the Get-ADComputer command and replace it with a fake list of server (server1 to server100), but you get the idea.

XML Template

I’ve also used an XML Template that I’ve created and used:

WRAP UP

Whenever you’re in doubt, DRY (don’t repeat yourself) re-use code whenever possible. XML or JSON are essential for storing settings or for exchanging information between different systems or applications (eg. web services or API). Generating an XML File with Powershell for an application requires sometimes a little effort and testing but the only heavy lifting required is to read the requirements of the output XML properly and reading the documentation  (from the .NET Framework https://docs.microsoft.com/en-us/dotnet/api/system.xml.xmldocument?view=netframework-4.7.2).

As usual, all source code is available on my GitHub repository.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.