0

I have retrieved a VBscript that may have worked in other scenarios to auto login windows ran by a task scheduler when windows is logged off by automating the logon process like a normal user would do on windows 10. IE: user arrives to a computer, presses enter for the login screen to appear, types in username, presses tab and enters password and clicks enter and the user logs in.

here is the script :

set wshShell = CreateObject("WSCript.shell")

wshShell.sendkeys "{ENTER}"

wscript.sleep 5000

wshShell.sendkeys "Username"

wscript.sleep 5000

wshShell.sendkeys "{Tab}"

wscript.sleep 5000

wshShell.sendkeys "Password"

wscript.sleep 5000

wshShell.sendkeys "{ENTER}"

WScript.Quit

now the code works find if i run it from a logged on user in windows, it presses enter types the username presses tab type password and presses enter, but when i create a task to run, nothing happens and if i look at the history of the task it says that the process ran successfully which means there was no errors.

I have tried to convert it to EXE still same results any help or fix would be appreciated,

Thank you.

3
  • Try running each part manually and see what happens before trying to run it in a script.
    – SDsolar
    Commented Mar 15, 2017 at 15:06
  • unfortunately, no luck.
    – Elie
    Commented Mar 15, 2017 at 15:16
  • Is there a reason why you would not use one of the two default methods windows already provides for autologin? This vbscript uses sendkeys which needs a target in focus and is not a great solution even in scenarios where users are logged on, I doubt it could ever work on the logon screen where a task would run with the system account and thus non interactive
    – Syberdoor
    Commented May 19, 2017 at 13:20

1 Answer 1

0

I cannot add comments so maybe this will answer your question or help. Are you using a .bat file to execute your script in the scheduled task? You would create a file named something like "Start.bat". It would just be a single line like this:

start wscript.exe "C:/Users/MyName/Desktop/PopUp.vbs"

When setting up this task, the file name would go here (see pic) - which I'm sure you already know performing these options:

Name > When computer starts > Start a program > Program script (browse to the .bat) > Finish

Browse file for scheduled task

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .