Click here to Skip to main content
14,971,553 members
Articles / Programming Languages / Visual Basic
Posted 7 Dec 2006


55 bookmarked

Remote Desktop Manager (MSTSCUI.NET)

Rate me:
Please Sign up or sign in to vote.
3.26/5 (10 votes)
7 Dec 20062 min read
Simply a graphical interface to Microsoft's command-line Remote Desktop Connection, mstsc.exe.


MSTSCUI.NET is simply a graphical interface to Microsoft's command-line Remote Desktop Connection, mstsc.exe. This application makes it easier for those who use Remote Desktop sessions often through the day. It uses the .NET Framework v1.1.

Some of the things this app demonstrates:

  • Reading a simple XML document
  • Creating a systray application
  • Dynamically populating a context menu

All in all, a very simple and useful little application.

General Use


MSTSCUI.NET runs as a taskbar application to allow quick and easy access to RDP servers:


It's generally reccommended to place an entry in your startup group so that the application launches on startup.

Simply right-click on the taskbar icon to show the menu:


Select "Edit List" for a shortcut to edit your server configuration file, and "Refresh List" to reload it.



Use the app.config file to set the name of the server configuration file with the "ServerConfigFile" key, and set your preferred editor with the "Editor" key. It's not recommended you change the "ServerConfigFile" key. The "Editor" key should be a fully qualified path if the editor you're using is not already setup in your path environment variables.

Below is the listing of the default app.config file:


        <!-- path to XML Server Configuration File -->
        <add key="ServerConfigFile" value="mstscui_servers.xml" />
        <!-- XML File Editor to use -->
        <add key="Editor" value="notepad" />


Server Configuration XML (mstscui_servers.xml)


Use the server configuration file to setup each server.

In order to display a horizontal separator bar on the menu, use:

    <server displayname="-" />

Each server element has an attribute called "displayname" - this is the name displayed on the menu. You can be as descriptive here as necessary.

  • servername - server name or IP address
  • port - default is 3389
  • resolution - "fullscreen", or any resolution entered in this fashion: 1024x728
  • console - 1 for yes, takeover console session, 0 for no, do not takeover console
  • connectionfile - fully qualified path to the RDP file if you want to use one

Below is the listing of a sample server config file:


    <server displayname="eventvan02 / secure">

    <server displayname="-" />

    <server displayname="vancorpbc1">


Select Code Samples


Launching msctsc.exe...

Private Sub ConnectToServer(ByVal sServer As String)
        Dim sCommand As String = _
          System.Environment.GetEnvironmentVariable("SystemRoot") & _
        System.Diagnostics.Process.Start(sCommand, _
    Catch ex As Exception
    End Try
End Sub

Reading the XML configuration file...

Private Function GetArgumentsForServer(ByVal sServer As String) As String

    Dim sConnection As String
    Dim sPort As String
    Dim sResolution As String
    Dim arrResolution() As String
    Dim sConsole As String
    Dim sConnectionFile As String

    Dim sArguments As String

    Dim parentnode As XmlNode = doc.SelectSingleNode("servers")
    Dim servernode As XmlNode = _
        SelectNode(parentnode, "displayname", sServer)
    Dim childnode As XmlNode

    For Each childnode In servernode.ChildNodes
        Select Case UCase(childnode.Name)
            Case "SERVERNAME"
                sConnection = " /v:" & Trim(childnode.InnerText)
            Case "PORT"
                If Trim(childnode.InnerText) <> "3389" And _
                        childnode.InnerText <> String.Empty Then
                    sPort = ":" & childnode.InnerText
                    sPort = String.Empty
                End If

            Case "RESOLUTION"
                If InStr(UCase(childnode.InnerText), "X") > 0 Then
                    arrResolution = Split(UCase(childnode.InnerText), "X")
                    sResolution = " /w:" & arrResolution(0) & _
                                  " /h:" & arrResolution(1)
                    'anything else, default to fullscreen
                    sResolution = " /f"
                End If
            Case "CONSOLE"
                If CBool(childnode.InnerText) Then
                    sConsole = " /console"
                    sConsole = String.Empty
                End If
            Case "CONNECTIONFILE"
                sConnectionFile = childnode.InnerText
            Case Else
                MessageBox.Show("Unrecognized node in XML: " & _
        End Select

    'build argument string
    sArguments = sConnection & sPort & sResolution & sConsole

    Return sArguments

End Function

Private Function SelectNode(ByVal parentNode As XmlNode, _
        ByVal attributeName As String, _
        ByVal attributeValue As String) As XmlNode
    Dim node As XmlNode = Nothing
    If parentNode.HasChildNodes Then
        Dim nodeName As String = parentNode.ChildNodes(0).Name
        Dim path As String = nodeName + "[@" + _
            attributeName + "='" + attributeValue + "']"
        node = parentNode.SelectSingleNode(path)
    End If
    Return node
End Function



This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Comments and Discussions

GeneralTerrible code !!! Pin
Mikhail_b31-Jan-09 17:41
MemberMikhail_b31-Jan-09 17:41 
GeneralRe: Terrible code !!! Pin
Ray Cassick8-Aug-09 6:39
MemberRay Cassick8-Aug-09 6:39 
GeneralRe: Terrible code !!! Pin
Mr President15-Sep-11 11:01
MemberMr President15-Sep-11 11:01 
GeneralMy vote of 1 Pin
Mikhail_b31-Jan-09 17:14
MemberMikhail_b31-Jan-09 17:14 
GeneralHi Pin
Venkat8010-Nov-08 4:07
MemberVenkat8010-Nov-08 4:07 
GeneralRe: Hi Pin
Anthony Collins10-Nov-08 4:21
MemberAnthony Collins10-Nov-08 4:21 
GeneralRe: Hi Pin
Venkat8011-Nov-08 8:48
MemberVenkat8011-Nov-08 8:48 
Generalre:system requirements Pin
RameshwerE6-Nov-07 2:19
MemberRameshwerE6-Nov-07 2:19 
GeneralRe: re:system requirements Pin
Anthony Collins6-Nov-07 3:00
MemberAnthony Collins6-Nov-07 3:00 
GeneralI am not able to run it Pin
Me the Lover27-Dec-06 5:47
MemberMe the Lover27-Dec-06 5:47 
GeneralRe: I am not able to run it Pin
Anthony Collins28-Dec-06 9:04
MemberAnthony Collins28-Dec-06 9:04 
Joke Pin 22:30
suss 22:30 
GeneralAlready existing Remote Desktop Manager Pin
dherv8-Dec-06 3:18
Memberdherv8-Dec-06 3:18 
GeneralRe: Already existing Remote Desktop Manager Pin
Anthony Collins8-Dec-06 4:38
MemberAnthony Collins8-Dec-06 4:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.