• Marc
  • 68.6% (Friendly)
  • Flock Member Topic Starter
Hi !

I'm facing a problem I could solve by writing a small program that uses the rdp activex control to connect somewhere automatically. Now I created a new Project in VS and added that control and everything is straight forward except for setting the password. There is put_Server(), put_UserName() etc. But I don't see a way to set the password. I quickly started my favorite rdp client mod ever to check if it allows specifying a password before connecting to the server and RD Tabs does! So may I ask how do you do it?

Best regards
  • Timothy
  • 100% (Exalted)
  • Flock Leader
Ah yes! The password fiasco. The RDP control is on its umpteenth version and as such has lots of weird old ways to invoke certain things and has deprecated some features you find in the older documentation (I remember searching on Google for how to set the password for a while). The current preferred way (Vista/Server 2008) is to use Network Authentication which pulls credentials from an OS prompt. Very secure (OS prompts like that override keystroke loggers and whatnot), but that sucks for scripting. Not to mention that Server 2003 doesn't support Network Authentication anyway... Luckily it falls back to just shoving the username/password to the prompt, but I digress...

There are two functions you need to use. (This is in VB.Net)

1. To set the password:
AxControl.AdvancedSettings.ClearTextPassword = "YourPassword"

2. To clear the password:
CType(Me.AxControl.GetOcx, MSTSCLib.IMsTscNonScriptable).ResetPassword()

The "non-scriptable" parameter is stuff you can't access from scripts (supposedly) but you can from regular languages by casting (that's the CType) the OCX reference of the control to IMsTscNonScriptable and invoking the function from there.

BTW: In COM parlance, I guess "ClearTextPassword" would actually be put_ClearTextPassword.