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)