Click here to Skip to main content
Licence CPOL
First Posted 1 Aug 2007
Views 165,810
Downloads 12,028
Bookmarked 237 times

Palantir - Remote Desktop Manager

By Isil Orhanel | 6 Aug 2007
Palantir is an application that allows users to manage remote desktop connections in one window. It also allows users to save existing connections for later use.

1
1 vote, 1.7%
2
4 votes, 6.9%
3
4 votes, 6.9%
4
49 votes, 84.5%
5
4.91/5 - 58 votes
5 removed
μ 4.66, σa 1.17 [?]
Screenshot - palantir.jpg

Screenshot - palantir3.jpg

Introduction

Palantir is an application that allows users to manage remote desktop connections in one window. It also allows users to save existing connections for later use.

Background

The remote desktop connections are managed with Microsoft RDP Client control. This control has all of the properties such as Server, UserName, Domain, etc. in order to set up a remote desktop connection. In addition to these properties, sharing printers, disk drives or color depth of the remote desktop can be managed via RDP Client control. Palantir enables users to create a remote desktop connection and save connection settings for later use. Users can also choose to start a remote desktop connection automatically when the application starts.

The settings can be saved into a file and restored from a setting file. Users can also connect to a computer via console. The application has a class named Machine that stores a remote desktop connection's properties. All of the remote connections created by user is stored in application's .settings file. This setting file has a property setting named MyMachine and its type is string. This property is converted into Hashtable while getting the settings. Palantir's solution consists of four projects which are GUI, Helper, BusinessObjects and a setup project.

Using the Code

The remote desktop connections are retrieved by the function below:

public List<Machine> GetRemoteDesktops()         
{             
    List<Machine> lstMachine = new List<Machine>();             
    if (Settings.Default.MyMachine != "")             
    {                 
        Hashtable ht = 
            (Hashtable)BinarySerializer.BinaryTo(Settings.Default.MyMachine);
        foreach (DictionaryEntry de in ht)                     
        {                     
            Machine insMachine = (Machine)de.Value;                     
            lstMachine.Add(insMachine);                 
        }             
    }               
    lstMachine.Sort(delegate(Machine m1, Machine m2) 
    { 
        return m1.RemoteDesktopConnectionName.CompareTo(
            m2.RemoteDesktopConnectionName); 
    });             
    return lstMachine;         
} 

As seen in the code, this function deserializes the setting named MyMachine into a hashtable and inserts each dictionary entry in the hashtable into a list and returns the list. A remote desktop connection is saved and edited by the function below:

public bool SaveRemoteDesktop(Machine parMachine, bool openedForEdit)   
{             
    if (Settings.Default.MyMachine == "")
    {                 
        Hashtable ht = new Hashtable(); 
        Settings.Default.MyMachine = BinarySerializer.ToBinary(ht); 
        Settings.Default.Save();
    }             
    Hashtable ht1 = 
        (Hashtable)BinarySerializer.BinaryTo(Settings.Default.MyMachine); 
    if (!parMachine.SavePassword) 
    {                 
        parMachine.Password = "";             
    }               
    if (!openedForEdit)             
    {                 
        foreach (DictionaryEntry de in ht1)                 
        {                     
            if (((Machine)de.Value).RemoteDesktopConnectionName == 
                parMachine.RemoteDesktopConnectionName)                     
            {                         
                MessageBox.Show("There is already a 
                                    remote connection with the same name.");                         
                return false;                     
            }                 
        }             
    }               
    ht1[parMachine.RemoteDesktopConnectionName] = parMachine; 
    Settings.Default.MyMachine = BinarySerializer.ToBinary(ht1);
    Settings.Default.Save(); 
    return true; 
}

If there's no currently saved remote desktop connection, we create a new hashtable and then serialize and save the settings file. After that, we deserialize the settings parameter into a hashtable and after checking if there's another connection with the same name, we save the remote desktop connection with the function's parameter Machine object. The methods below set the RDP Client control's settings and connect to the remote desktop which is passed as parameter.

private void SetRdpClientProperties(Machine parMachine)   
{             
    rdpc.Server = parMachine.MachineName;             
    rdpc.UserName = parMachine.UserName;             
    rdpc.Domain = parMachine.DomainName;             
    if (parMachine.Password != "")             
    {                 
        rdpc.AdvancedSettings5.ClearTextPassword = parMachine.Password;   
    }             
    rdpc.AdvancedSettings5.RedirectDrives = parMachine.ShareDiskDrives;     
    rdpc.AdvancedSettings5.RedirectPrinters = parMachine.SharePrinters; 
    rdpc.ColorDepth = (int)parMachine.ColorDepth;             
    rdpc.Dock = DockStyle.Fill;           
} 
public void Connect(Machine parMachine)         
{             
    SetRdpClientProperties(parMachine);             
    rdpc.Connect();         
}           
public void ConnectViaConsole(Machine parMachine)         
{             
    rdpc.AdvancedSettings5.ConnectToServerConsole = true;    
    SetRdpClientProperties(parMachine);        
    rdpc.Connect();         
} 

Feedback

For bug reports and suggestions, feel free to contact me at io1981@hotmail.com.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Isil Orhanel

Web Developer

Turkey Turkey

Member


Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralParabéns muito bom PinmemberMMatani8:30 15 Dec '11  
Questionremote desktop Pinmembermohanrajkiller4:38 12 Nov '11  
QuestionWhat should I enter in Machine Name, Domain, Username and Password? Pinmemberdonvsme7:22 20 Oct '11  
Question:( Pinmemberkusum nayal3:48 20 Oct '11  
Questiongood work Pinmemberkusum nayal1:47 20 Oct '11  
GeneralMy vote of 5 Pinmemberma_guangming21:07 14 Oct '11  
GeneralMy vote of 5 PinmemberA.Adnane4:47 23 Jun '11  
Generalnice article PinmemberAJMAL SHAHZAD21:58 11 May '11  
GeneralMy vote of 5 Pinmemberlongkk16:56 21 Apr '11  
GeneralTebrikler / Congratulations Pinmemberhepicoder12:17 5 Mar '11  
General5 For my vote Pinmemberbabakzawari10:43 2 Mar '11  
GeneralMy vote of 5 PinmemberSAKryukov11:13 19 Feb '11  
GeneralLooking at the remote desktop template, help with automating acknowledgement of the legal banner Pinmemberturbosupramk38:57 27 Dec '10  
GeneralMy vote of 5 Pinmemberamitsinh parmar1:32 21 Dec '10  
GeneralAdditions PinmemberDaaron12:48 30 Apr '10  
QuestionHow to access an IP that is behind the NAT router ? Pinmemberdmuntoiu2:57 6 Mar '10  
Generalproblem when auto connecting Pinmemberatropos0722:24 3 Mar '10  
GeneralGood Work PinmemberNezam Ahamed19:37 22 Feb '10  
GeneralGood Work PinmemberA.Adnane23:04 26 Jan '10  
Generalbeautiful! Pinmemberkanbang0:03 12 Aug '09  
Questioncan u please tell now i am getting this error after change AxMsRdpClient5 to AxMsRdpClient2 Pinmemberravileeladhar8:42 20 Jul '09  
GeneralException ::Error 8 'AxMSTSCLib.AxMsRdpClient4.AdvancedSettings5' is not supported by the language Palantir Pinmemberravileeladhar8:40 9 Jul '09  
GeneralRe: Exception ::Error 8 'AxMSTSCLib.AxMsRdpClient4.AdvancedSettings5' is not supported by the language Palantir PinmemberAKGhosh21:25 19 Jul '09  
GeneralNice Article PinmemberVuyiswa Maseko22:14 4 Mar '09  
GeneralNeed your help! Error:Class not registered... PinmemberMember 388611715:50 15 Feb '09  

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

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

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120206.1 | Last Updated 7 Aug 2007
Article Copyright 2007 by Isil Orhanel
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid