***** Some good TIPS to get Auto-Remote desktop work with your .Net 2.0 + frameworks... Read On...
You can either use either RDP Client or mstsc.exe to log onto remote desktops.
- Look up for the RdpClient.dll in your system32 folder (This wraps itself in an active X component & derives from AxHost) �Easier one �See the example of “Palantir�/strong> �Good & easy one (This needs to be done on a windows forms) on Code Project…or Just google it.
- The tricky one is directly logging in using mstsc directly (without typing in the username & password all the time). How do you achieve this ? Well, after quite a lot of R & D.. I came up with this.
- When you Run “mstsc.exe� it would pop up with a dialog, go to >>Options( Do all that you want there) & then click �strong>Save As �. it would then be stored as “Default.rdp�
- Open this “Default.rdp�in notepad…You would get the idea.. You are half way through .
- The username is stored as is.
- The password is encrypted using a special algorithm and stored in this RDP file as range of 1329 bits .(“Password01�or “Passowrduehw03�are going to be encrypted into the same range of 1329 bits but will differ in individual bit values.
- The challenge here is to encrypt it, you have to apply the same algorithm as internally must be done by remote client while making an RDP file�/span>
In the code, simply get the user details(say from a Windows forms user log on form- One time & store it in Application Settings ).. Encrypt the password by UTF8-ENCODING (Not anything else) .Save it into an RDP file, say “Remotemachine.rdp�. Start the Process, give the Process instances “StartInfo.Arguments�/span> as path to this rdp file & �/strong> StartInfo.FileName�as �systemroot%\system32\mstsc.exe� Start the Process…it would connect to the respective remote machine and decrypt the password by itself.(You have to send the encrypted bits like:
sw.WriteLine( "password 51:b:" + encyptedPasswordbits); ('sw' is the instance of File Writer Class)..
Just take care that it would not connect properly if some of the credentials are not perfect. Any queries you may post it on this forum or mail me @ shyam_b85@yahoo.co.in
Regards,
Shyam B
(Bangalore India)
www.quicksearchlinks.com (ON
SALE !!)
Refer to
AcousticGuitar 's forum post above on how the RDP file looks like when opened in notepad..
Password might look something like so:
password51:b:01b01010111010101010101101001001010110110101010100000001010101010101010110101010101010010111101010101011111111111111010100101