Crypto Mining While Your PC is Locked

1cintron
3 min readNov 7, 2018

A few months ago I was looking for a clean solution to setup my main desktop computer, running Windows 10, to mine while I was not using it. After some digging I found out that this is possible without writing an application using the native Windows Task Scheduler. Below I will go through the steps I took to setup my machine to mine using two different mining executables whenever I lock the computer (or it does so after some period of inactivity).

I will be setting up this computer to automatically run stak-xmr.exe for CPU mining and Claymore 11.2 for GPU mining on the RX 580 this computer has. The first step is to create a windows batch file that sets up any required environment variables and calls the miner executables with any flags/switches required. I named this file MinersAutoStart.bat.

The next step consists of creating another batch file to kill the miners. This script will be called by the scheduler once the users logs back into his or her computer. This file was named MinerStop.bat.

Once the scripts have been saved, make sure that if you run the MinersAutoStart.bat by double-clicking it or via command-line your miners of choice run as expected. Once miners are running, execute teh MinerStop.bat to ensure it is able to kill the mining processes created. After this, all we have to do is create the schedule tasks using Windows Task Scheduler.

The Windows Task Scheduler (on Win10) can be found at C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools or by searching Task Scheduler. Once opened, click on Create Task… located in the Actions panel on the right-hand side of the tool.

In the Create Task window, enter your name of choice for the task in the General tab, I called it StartMining. Click the Triggers tab, and add a Newtrigger. On the New Trigger window, make sure you select On Workstation lock from the dropdown list next to Begin the task. You can select whether you want this action to be triggered by any user or a specify user. Ensure the Enabledcheckbox at the bottom is checked. Click OK.

Once the trigger to begin the task has been selected, go to the Actions tab, click New, select Start a program from the dropdown list, and type-in or use the browse button to select the script to execute, in this case MinersAutoStart.bat. Press OK. Then OK again to finish creating the task.

At this point, your task for calling the script to start the miners is complete. Repeat the previous step to add the task for the script that stops the miners, with the only exception that the trigger selected in the New Trigger window will be On workstation unlock and the script selected in Actions is StopMiners.bat.

Test your triggers and make any other additional tweaks using the advanced settings in the task scheduler to meet your needs. Hope this helps!

--

--