This article covers how I used Tasker in conjunction with AutoRemote and EventGhost to create an event that locks your Windows workstation when you walk away.
For a while in the early 2000s the company I worked for had a department filled with salespeople whose idea of fun was messing with someone’s computer when they stepped away and forgot to lock it.
The computer owner would return to find their desktop had been replaced by a picture of their desktop and nothing was clickable, wallpaper changed to something grotesque, system sounds set up to annoy, etc. People learned to lock their computer before stepping away.
Back during those times I got called to clean up a lot of computers, wasting a lot of the company’s money and my time. The solution we implemented was to set an auto lock time, but this didn’t help very much if someone got called away unexpectedly and forgot to lock their computer as there was a hoard of howling salespeople ready for mischief.
People were also getting annoyed that if they were on a phone call their computer would lock in front of them requiring yet another entry of their password, so they’d ask for the timeout to be extended.
As most people are now glued to their phones these days and wouldn’t leave a device capable of even more mischief than a PC in reach of others, using your phone to lock when you walk away seems like the perfect solution.
If you’re not in the situation of dealing with people messing with your computer, but still want it locked when you’re away from it for security’s sake, this might be useful to you.
Additionally since we’ll be assuming the PC you’re looking at locking is in a work environment we’ll plan to send data to and from EventGhost using the Chrome Autoremote plugin as this won’t require an IT department to open and forward ports
EventGhost configuration can be a bit tricky, so set aside a bit of time and follow the first steps tutorial for getting it working to the letter. There’s really nothing I can expand on over their instructions, so I’m not going to cut and paste pages of setup.
Building the lock
In AutoRemote on your Android under Preferences, EventGhost, I went ahead and checked Fallback to Chrome and Skip Local IP and Skip Public IP. There’s nothing going to get into my firewall from outside, and I don’t really want to open any ports through the machine firewall to handle the EventGhost messaging traffic.
Make sure your Android can communicate with EventGhost before going any further. There’s a test message option, send yourself some test messages and make sure they make it to Windows. If a message can’t make it to Windows the rest of this is going to be useless.
On EventGhost on the PC we’re going to add a macro, system, Windows Command. The command line you’re going to use to lock a WIndows workstation is “rundll32.exe user32.dll, LockWorkStation” without the quotes. Save it and name it something descriptive like “Windows Command: Lock Workstation” or leave it as is.
On AutoRemote on your Android, send a message to the Windows Workstation that you’re going to want to use to lock the machine. I simply used the word “lock.” You’ll see on the Windows device in the EventGhost left side log an entry with a lightning bolt next to it that says “AutoRemote.Message.lock”.
Drag that event above the Macro action. Send the lock message again, if all works well your workstation will immediately lock.
Simply press ctrl-alt-del to log back in and you should be right back where you left off.
Tasker action to lock
Run the action by itself and you should see your computer lock.
Tasker profiles to trigger action
Not knowing your exact situation I can’t give a universal answer for what you want to do to trigger the lock. You can trigger on many things such as WiFi signal strength, losing a Bluetooth connection, AutoLocaton geofences, testing whether the phone is plugged in and charging at the desk, or simply create a widget to lock the workstation.
For me I’m just using a geofence. I’m not particularly worried about people coming into my office when I’m in the building, but I do worry a bit when I’m off-site as our building has some tenants who have access to the switch rack near my workstation.
Alternate ideas for actions
Instead of the locking workstation you can use any command. You can also receive notifications on your phone if someone is messing with your computer by setting up eventghost actions.
- Setting the volume to maximum and playing an airhorn (good for cats too)
- Turning on the camera and taking a picture and emailing it to yourself
- Remote wipe of the computer