and has 2 comments
Well, sometimes an admin will try to make the system secure by annoying the people who have to use it. Yeah, that always works. My situation is that I have to login every day into a virtual machine that is on a "secure network". So after using a very restrictive password policy that forces everybody to be creative in the way they write "password" and "123456", he also disallowed the saving credentials in Remote Desktop Connection. So every day I have to enter the damn complicated password. I couldn't have that. Here is a .js script that you execute with WScript and it logs you in automatically:
var shell = WScript.CreateObject("WScript.Shell");
shell.Run("mstsc /v:[remote server] /console");
while (!shell.AppActivate("Windows Security")) {
WScript.Sleep(100);
}
WScript.Sleep(100);
shell.SendKeys("[password]{enter}");

Save this into a Javascript file and replace [remove server] and [password] with your settings and either double click the .js file or create a batch file like this:
@echo off
start "Auto log on!" wscript c:\Batches\autologin.js

Of course, this means your secure password will be stored in a stupid text file somewhere, so be warned.

Comments

Siderite

This is a simple hack with a very simple tool. SendKeys is not even guaranteed to work, since between you send the keys and when they take effect the app may have switched to something else, already. Even so, SendKeys doesn't work with RDP. You probably need an external application, like AutoKey, or a program you make yourself and copy to the remote machine. Check out this answer: https://social.msdn.microsoft.com/Forums/en-US/01d1c501-880a-48c3-8b82-d3b08e974ff0/remote-desktop-connection-sendkeys

Siderite

KAPIL MEHTA

Can i use sendKeys on remote machine to perform some operations on remote machine ? How can i swich focus to remote machine window ? Tried below code but didn't work :- shell.AppActivate("10.x.x.x - Remote Desktop Connection")

KAPIL MEHTA

Post a comment