SQLServerCentral Article

Alternative to the Microsoft MMC Console

,

Alternative to Microsoft's MMC Console

The Problem

How many of you have 10+ SQL servers? How many of you are sa's for another 100 boxes? I and my co-workers are in the plight where we need to administer and access many different servers, easily switching from one to the other. At this point you may be saying, "I use Microsoft's MMC console and it works great for just this purpose." It is true that Microsoft's MMC console is very handy, but it has some very serious shortcomings. Those of you who administer a larger number of servers are probably aware of MMC's inability to alphabetize itself. This is especially cumbersome when you change server naming conventions or something else causes you to be constantly deleting and adding servers to your list. Other problems which have caused great frustrations on my part are the frequency with which it crashes, especially when another console is open, and the lack of descriptions for any of the servers. I have tried everything I could think of including studying and modifying the XML type MMC file but to no avail.

The Solution

I lived with these annoyances for close to a year, laughing at my co-worker (who administers even more boxes than I do) as he worked with the same frustrations, and occasionally searching the web for a hack to get the list ordered. Finally, as the number of my servers was growing and I was becoming desperate, I decided to attempt writing my own console. Most of my non-database work deals with web pages, in one form or another, so naturally I turned to a web-based solution. There were five minutes left to my day at work so I decided to do a quick search to see if there was any hope for my new idea. In less than ten seconds I was reading about Microsoft's MSRDPClient which is a web-based, ActiveX control, allowing the end user to connect to an RDP session from inside Internet Explorer. While this was the first time I had heard about this feature, it seems to have been around for quite some time. There are many tutorials and descriptions on the net of the various settings which can be done with it as well as how to deploy Microsoft's demo page containing it. However, I was not able to find anywhere where someone had actually taken the time to build a new and better MMC console with this object. You can download the package here:

http://www.microsoft.com/windowsxp/downloads/tools/rdwebconn.mspx

Note: You do have to be running at least win2000 server for this to work effectively.

Benefits

The benefits to using a web-based solution are fairly evident. Web pages are very modifiable giving, likely, the most customizable interface possible. Being an embedded cab object, the pages can be built without the use of any server side scripting languages. In fact, the demo page which ships with the utility is a simple DHTML page. Using a scripting language does, however, allow us to take advantage of databases to easily add and remove servers from our new "MMC Console".

Downsides

There aren't very many downsides to this method. Microsoft says that this control provides most of the functionality of a traditional RDP client, thereby insinuating that it doesn't have all the functionality. I have noticed that the control doesn't always get focus (on the page I created) immediately. I have also not looked into adding the ability to right click on a connection to easily disconnect from it. The IE menu bars also cause the viewing area to be reduced; I was able to work around that by grabbing the functionality found in a cab file from another page on our local Intranet. Unfortunately, for various reasons, I am unable to release this cab file; even worse I don't personally know the code to do this. However, there is java functionality (plenty of documentation on the web for this) which will cause the desired effect although it will force you to open a new IE window.

Implementation

I have provided two files for download to give a head start in setting up this new MMC idea. The html file builds on Microsoft's default file to show that this can be setup with un-embellished DHTML. The asp file is my current progress on creating a full blown MMC database driven console. The more I use this new product the more I will likely be finding new ways to make it better but this is a good start for anyone.

In order to maintain the state of every connection offered on the page I was forced to create a separate cab object for every connection available. The html file shows this and gives a basic template as well as working interface for those who wish to test the idea before going through the whole setup and development process. The two files I have provided are dependent upon you downloading and installing the tswebsetup.exe file which is linked to above. By install I mean execute the self extracting compressed archive. I have changed all the server names and include files for security reasons so you will need to re-connect things on your end for it to work correctly.

In the main connection sub "BtnConnectCustom" you will find several lines that look like this:

tempObject.AdvancedSettings2.ConnectToServerConsole = TRUE

From looking on the web, I noticed that there seem to be about a hundred of these lines allowing the implementer to get very granular in the setting specified for each connection. If you want to add additional features then I highly recommend the first step be to look to see if the AdvancedSetting1,2,3 exists for it. If you are looking more for a solution which you can deploy to your users as a single full screen connection; this control has settings for that as well called object.FullScreen = Boolean. It will even allow you to control how the full screen title bar functions and what it says using object.FullScreenTitle = String.

On of my favorite features of this ActiveX object is the object_OnConnected and object_OnDisconnected(disconnectCode) subs it calls when it connects to disconnects for any reason. This allows me to track activity or offer extra functionality whenever one of these events occurs. Currently I am simply using them to hide or display the correct object, but who know what someone will need them for in the future. One idea could be to use the OnDisconnected sub to try and re-connect to the server. This could give the functionality to users of getting a message saying the server was down and to call the IT department then the page would automatically reconnect when the server came back up.

Creating the Implementation

Most of the hard discovery and trial and error was done with the simple html file. After I had a fairly good understanding of the ActiveX RDP object, I renamed it to an asp file and linked it to a database. Here are some of the usability features I created.

  • By setting the page to NT authentication on our web server I was able to pull the users credentials and break them down into username and domain variables to auto pass credentials to the opened connections.
  • Implementing the "title" feature of the "span" tag I was able to add server descriptions which would appear when the mouse was hovered over the text.
  • By adding classes of "link" to the connection span tags I changed the mouse pointer to a standard hand, showing users that it could be clicked on. This feature is in my external style sheet and will need to be added for the span.link style if you want it. .link{CURSOR: pointer;}
  • On a suggestion from my co-worker, I added a text box at the top of the screen which allows the user to connect to any random server they please. This offers more functionality since the user is no longer restricted to the list at the side of the screen.
  • One of my favorite features of the MMC console was its ability to auto detect the screen area it can use, not to be outdone I added this to the list of features my new console sported by using VBScript to grab the offset Width and Height of the element containing the connection object.
  • Unfortunately by making the screen size large and using tables to hide the unused connections I ended up with scroll bars on the page. I resolved this issue as well with styles sheets..NoScroll{overflow-x:hidden;overflow-y:hidden;}
  • Considering how many servers we support and the number of datacenters they belong to, I needed some method of categorizing my list. To this end I added a group column to my SQL table. Using SQL to get the proper order (it is great at that ?), I put a simple little if statement on my page to print a header every time a new one was encountered.
  • Running into a problem where my list of servers began to flow off the page, I ripped a set of the plus and minus signs (the ones that designate expanded or consolidated lists) from MS Outlook. Wrapping each list of servers in its own span tag I was able to use VBScript to show and hide the lists when this image was clicked on.
  • When first getting the thing up and running, I had removed all of Microsoft’s error checking code for the purpose of more easily understanding what was going on. Now I was having an issue where I couldn’t connect to various servers but didn’t know why. So I broke down and added the error checking code back modifying it a bit to work with my new interface.
  • After a day of using this new interface I was finding it difficult to easily see which server I was connected to. So, I used VBScript to set the backgroundcolor style for each individual span tag when it was the one connected to.
  • On a suggestion from my co-worker, who does much more of the sa work than I do, I added a check box to allow the user to connect to a boxes console.

Conclusion

Many of you who look the code I have written will probably wonder, "what was he thinking" or, "what a stupid mistake" for various pieces of it. Please remember this is only the work of a couple hours, and is simply meant to get me up and running in a more productive environment. This code has by no means been tested thoroughly, nor has any attempt been made to do so. I developed this idea for use in our IT department and figured that most of the staff would be smart enough to deal with any error they come across. Over time we will iron our any issues which continue to bug us, but for now it is a significant improvement over what we had.

You can download the files here (right click and save as):

The New "MMC" Files

I was prompted to write this article by my co-workers enthusiasm the first time I showed him my idea. His excitement made me think that there might be others who would like to know about this idea. If anyone has developed alternate or better free solutions I would be excited to here about and/or see them.

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating