Creating a Remote Desktop MMC

I was shown a useful custom MMC this week, a list of servers in an RDP container. You could RDP on to any server just by clicking it. Only problem was only had a few servers in as each had to be added manually. A repetitive task is perfect for automation I though. Nothing however is quite that simple.

Creating a new MMC is easy enough using the MMC20.Application COM interface. It is even fairly well documented. You may not have the Remote Desktop snap-in available. You need the Microsoft Remote Server Administration Tools installed and configured on your computer. This article here shows you how to do it on Windows 7.

So I can create the MMC and add Remote Desktops. Getting the list of servers from Active Directory can be done by finding all AD objects with the operatingSystem property containing the word server. However trying enter the server name through the COM interface alluded me. After a couple of hours going around in circles I gave up on this approach.

Instead I used the following fiddle; filling the keyboard buffer with the commands and server names needed and letting the MMC application read this in. This works but you cannot use the computer while it is populating the MMC (the period between the MMC being displayed on the screen and the python script finishing).

The finished script adds about 4 servers a second so it shouldn’t take more than a few minutes to complete.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s