I was pretty sure this question wouldve been already asked, and I tried hard to find a solution but couldnt find much.

I'm trying to lock/unlock my PC from my Android device. I dont want to use BTProximity to do this because even if I'm in another room in the house, it would be able to detect my phone and unlock the computer. I want finer control over the event that triggers the lock/unlock, instead of relying on proximity.

I would be very happy to use tasker to achieve this, although I'm unable to find any way for my PC to lock/unlock with anything tasker can do.

The solution can either be for Windows or Ubuntu, or both.


The best integrated solution with your Android phone and PC is to use Autoremote and EventGhost. The general idea is that you use AutoRemote to send a message to Eventghost which then unlocks or locks your PC. The task will look something like this:

     DEVICE: NAME OF COMPUTER OR CHROME EXTENSION  <----Addressed at the end 
     MESSAGE: Unlock (Really could be anything)

Next is the EventGhost side. Eventghost doesn't always respond especially if your not on the local network but you can get around this with AutoRemote's Chrome ExtensionIf you have any trouble with AutoRemote, the developer has a great website and is very active in his google group. The direction to install the AutoRemote plug into Eventghost can be found here. Here are the steps to create the Eventghost trigger:

  1. Create a Macro but don't worry if you can't find the AutoRemote Plugin. This is really a fancy folder
  2. Add an event from the toolbar which will trigger the eventghost macro. It should look like this: Autoremote.Message.unlock
  3. Next are your actions. This will unlock your work station

If you have any questions feel free to ask them in the comments and I'll do my best to quickly respond.

If my answer solves your problem please don't forget to mark it ask the answer and upvote it for it's usefulness. I'm new and trying to build my reputation here.

  • Thanks a lot, this looks promising. Although, It would take me some time to implement this and verify. If someone else succeeds using this method, then do comment here. – Urban Jun 28 '14 at 0:39
  • It shouldn't take too long to set up since the links that I proved are direct links to the files that you need. Once downloaded you'll only need to drop and drag them into event ghost to make them work. – The3rdIcon Jun 29 '14 at 2:57
  • What connection between Android and iOS does it use: Wifi / Bluetooth / anything else? – yurkennis May 12 '15 at 20:08
  • "This will unlock your work station" -- the linked post requires to download and run MyUnlocker which is Windows BAT file. Is there a similar script/program for OS X? – yurkennis May 12 '15 at 20:58
  • Evenghost, which drives everything, is only for PC. – The3rdIcon Sep 23 '15 at 18:37

You can use an NFC phone to unlock your PC from the LAN, aka scan an NFC tag and login to Windows. On your Android phone, install the following software: NFC Tools, NFC Tasks, Tasker, Unified Remote (all from the play store). On your PC, install Unified Remote server.

  1. Configure Unified Remote app on your phone to connect to your pc, communication should set to encrypted

  2. Use Tasker to create Unifed Remote (via Tasker's integrated UR plugin) click, tab and stroke events, to automatically type your password for you at the lock screen (list of commands in the proper order that matches your lock screen). You have to play around with it to configure it properly, test tab orders, arrow strokes etc.

  3. Use NFC Tools & Tasks to write Unified Remote commands executed by Tasker on any compatible NFC tag.

It will take some time to make it work, but it does and you have to pay a few dollars for some of the apps, they are not all free. The process it's safe if you protect Tasker with a PIN and secure Unified Remote communication. First logon has to be performed in the classic way (keyboard), to allow the Unified Remote server to start.


I have actually implemented this in a similar manner to The3rdIcon. Use his answer to get the framework, and I can provide details. Note that the unlocker program he links doesn't work for Windows 7 and up, but this trick will. For my particular case I used a bluetooth device attached to my workstation for proximity detection but you can do whatever is applicable. Here are the actual details.

Since the PCs I'm working with are behind a firewall, I'm using AutoRemote's Chrome extension redirect which works very well.

Tasker Bluetooth Near profile

Notes: Ignore the %WorkHint bit, it's for something else. This profile does require that you be paired to the device, but not connected. It isn't terribly responsive (for battery saving reasons) but will detect near/far within a few minutes. Additionally I use a couple other profiles that can trigger an unlock so that it's more responsive but this should get you started. My example sends to an AutoRemote channel (Work) so that it can lock/unlock 2 computers for me.

Profile: BT Work Near (166)
State: BT Near [ Name:yourbluetoothdevice Address:* Major Device Class:Audio / Video Standard Devices:On Low-Energy (LE) Devices:Off Unpaired Devices:Off Toggle BlueTooth:Off ]

Enter: Anon (167)
A1: Variable Set [ Name:%WorkHint To:true Do Maths:Off Append:Off ] 
A2: AutoRemote Message [ Configuration:Recipient: Group
Message: Unlock
Channel: Work Package:com.joaomgcd.autoremote Name:AutoRemote Message Timeout (Seconds):200 ]

Exit: Anon (168)
A1: Variable Clear [ Name:%WorkHint Pattern Matching:Off ] 
A2: AutoRemote Message [ Configuration:Recipient: Group
Message: Lock
Channel: Work Package:com.joaomgcd.autoremote Name:AutoRemote Message Timeout (Seconds):200 ]

EventGhost Lock Macro

Notes: These use a little trick to accomplish lock/unlock. It essentially disconnects from the console session and later reconnects to it for the unlock. It still displays the CTRL-ALT-DEL screen and someone seeking to use the PC would actually have to log in. Note that the reconnect trick will not work if you use the EventGhost lock workstation action or an actual WIN-L lock.

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1700">
    <Macro Name="Lock Workstation" id="6" Expanded="True">
        <Event Name="AutoRemote.Message.Lock" />
            System.Execute(u'c:\\windows\\system32\\tsdiscon.exe', u'', 0, False, 2, u'', False, True, u'', False, False, False)

EventGhost Unlock Macro

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1700">
    <Macro Name="Unlock Workstation" id="9" Enabled="False" Expanded="True">
        <Event Name="AutoRemote.Message.Unlock" />
            System.Execute(u'C:\\Windows\\System32\\tscon.exe', u'1 /dest:console /password:yourpassword', 0, False, 2, u'', False, True, u'', False, True, False)

I do use a couple other macros to send a notification to my phone when the PCs are locked or unlocked either automatically or manually. I can post those as well if there is any interest.


This program for Windows does both lock and unlock, allows to adjust the distance (as you requested), notifies your phone if anyone tries to steal your laptop, allows to lock/unlock with your phone fingerprint reader and blocks the screen saver when you are within Bluetooth range.

You'll need to install the program in your Windows PC, an app in your Android phone/smartwach and select a Credential Provider in the lock screen. It is free but has ads on the phone.

The site also has a program for Mac.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.