Jump to content
Sign in to follow this  
frozensun

Solution to "Computer Locked" Screen (CTRL + ALT + DEL scripting)

Recommended Posts

frozensun

EDIT: Whoops, just realized this should have gone into the Code Example Forum. Can someone move it for me please?

Hi Everyone,

I've been using Autoit for a while, and one problem I've run into is not being able to script the dreaded "Computer Locked", aka ctrl+alt+del. I've tried all sorts of solutions, none of which have worked, until now, and I thought I would share with the community. I have not seen anyone else try this, but if you have, kudos to you :-) Essentially what I did was install a vnc server, allow local loopback connections, and a script to connect to myself (behind the scenes). Since the VNC folks already have a method to send the ctrl + alt + del, I thought that would be the most useful. Here is a basic walkthrough:

1. Download and install TightVNC, both client and server.

2. Right Click on the new VNC icon in the system tray.

3. Click Properties.

4. Set a password.

5. Click Administration.

6. Check "Allow Loopback Connections"

7. Click ok

Now use the following code to create a script, filling in the appropriate passwords where required.

CODE
#cs ----------------------------------------------------------------------------

AutoIt Version: 3.2.11.3 (beta)

Author: Jason More

Script Function:

Unlock the computer using VNC

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

sleep(2000)

;slowing down the key presses helps with the connection

opt("SendKeyDelay",10)

;this should point to your tight vnc installation

run("C:\Program Files\TightVNC\vncviewer.exe","C:\Program Files\TightVNC")

winwait("New TightVNC Connection")

controlsend("New TightVNC Connection","","Edit1","localhost")

controlclick("New TightVNC Connection","","Button5")

winwait("Standard VNC Authentication")

;REQUIRED VNC PASSWORD

controlsend("Standard VNC Authentication","","Edit3","Replace with your VNC password")

controlclick("Standard VNC Authentication","","Button1")

winwait(stringlower(stringlower(@ComputerName)))

sleep("250")

controlclick(stringlower(@ComputerName),"","ToolbarWindow321","left",1,124,13)

;REQUIRED USERNAME PASSWORD

controlsend(stringlower(@ComputerName),"","ChildClass1","Replace with your Logon Password{Enter}")

sleep("250")

winclose(stringlower(@ComputerName))

I hope this can help someone. Any questions let me know.

Frozensun

Edited by frozensun

Share this post


Link to post
Share on other sites
akshataRao

Thanks a Lot for the solution. Its works like a charm.

However I wanted to put in a check if the system is locked or unlocked. If this script runs when the system is unlocked I see multiple windows so what do I need to check to know whether the system is locked ?

Thanks in advance.

Share this post


Link to post
Share on other sites
LoWang

I got it

http://blogs.technet.com/heyscriptingguy/archive/2004/11/15/can-i-lock-a-workstation-using-a-script.aspx

somewhere in the middle.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.