0

Currently Im trying to do an automatic logon over rdp with the Internet Explorer. Basically what I'm trying to do is opening an ActiveXObject which then calls cmdkey to store the credentials temporary

var ws = new ActiveXObject("WScript.Shell");
setTimeout(function(){
  ws.Exec("cmdkey /delete:"+servername+" ");
}, 100);
setTimeout(function(){
  ws.Exec("cmdkey /generic:"+servername+" /user:"+username+" /pass:"+password+"");
}, 500);
setTimeout(function(){
  ws.Exec("mstsc /v:"+servername+"");
}, 800);
setTimeout(function(){
  new ActiveXObject("WScript.Shell").Exec("cmdkey /delete:"+servername+" ");
}, 20000);

First I thought the problem would be the cmdkey delete running before the mstsc could establish the connection, but even with a 20s timeout it still wasn't really working.

With "Not really working" I mean it works on some computers and on some computers not. And this is either Account-based (on the computer) or just generally working on a computer. Why is that? (I can't tell)

I'm currently testing it on IE11.0.48 with the js running locally on xmapp.

Does someone know the problem? or am I doing something wrong? (OR would there even be a better solution for this?)

//EDIT1: ActiveX is allowed internally and the mstsc gets called everytime but the autologon is the thing that doesnt work (at least not everytime)

Dead Master
  • 110
  • 14
  • Most likely your users can't run ActiveX via a web page. – Teemu Jan 15 '18 at 07:22
  • @Teemu I have forgotten to add this but I edited my post and ActiveX is allowed but the autologon doesnt work (sometimes) but the MSTSC gets called everytime. – Dead Master Jan 15 '18 at 07:27
  • Yes, it is allowed on your machine when you're running the page locally, but on the production, your users can't get it to work, in case you're delivering your app via the web. – Teemu Jan 15 '18 at 07:42
  • @Teemu The xampp is running locally on my computer but the users can access it over my hostname and ActiveX is allowed for every Service internally in our network so users on other computer can use it and it works on different computer but not on all. (mstsc gets called everytime but the autologon fails sometimes) – Dead Master Jan 15 '18 at 07:49

0 Answers0