How-tos: Bot Runner

Logging

Introduction

ElectroNeek Bot Runner features automated logging. The autolog file is the most important source of information that you can receive and send to the Support Team in order to solve a certain issue. It contains all the information in regard to your machine specifications, the version of both Bot Runner and its components, and every step of the workflow as well. Thus, it is the most detailed log file created automatically.

The file has a certain structure:

  1. Environment information (OS version, components versions, etc.).
  2. Information describing every step of the bot. The start and end steps of the bot execution are also recorded.

The information is displayed as: “Time of log-message - JSON”, for example:

16:26:46.328 {"programs":[{"program":"InternetExplorer","version":"11.789.19041.0"},

{"program":"Chrome","version":"91.0.4472.124"},

{"program":"1C"},{"program":"ElectroNeek Studio","version":"5.6.11.0"},

{"program":"ElectroNeek Robot","version":"5.6.11.0"},

{"program":"msedgedriver.exe","version":"79.0.313.0"}],"windows":{"caption":" Windows 10 Pro","version":"10.0.19042","csd_version":0,"os_architecture":"64-bit"},

"cpu":{"name":"AMD Ryzen 7 3700U with Radeon Vega Mobile Gfx","number_of_cores":4,"number_of_logical_processors":0,"number_of_logicalprocessors":8},

17:03:21.706 {"activity_name":"START","file":"C:\\Users\\owlyo\\Desktop\\Bot Text\\Text bot.neek
","script_id":"b8c90d98-e2a5-49c2-9ddd-28d77172bb59","memory_usage":117484,"version":{"launched_by":

Bot Runner Autologs

To enable automated logging:

  1. Right-click on Bot Runner icon in the tray.
  2. Go to the “Settings” menu.
  1. Go to the “Execution” tab.
  2. Check the “Automatically create logs for each run” box.

The autologs can be found in C:\Users\{Username}\ElectroNeek\logs\robot folder or simply by pressing on the “Open logs” button (right-click on Bot Runner icon in the tray).

Autologs contain the following information:

  • Environment information:
    • Standalone or Dependent.
    • Application version.
    • Google Chrome/MS Edge version.
    • Webdriver version.
    • Extension's version.
    • User information:
      • Region.
      • uID.
      • License.
      • Permissions.
  • Events:
    • Process flags.
    • Login - with a link to a .neek-file link.
    • Logoff.
    • Start workflow.
    • End workflow.
    • Messages from the Studio Pro console.
  • Network events:
    • Failed requests with URL, parameters, message.
    • Connection to sockets (with URL).
    • Socket connection failures (with URL).
⬅️


How to exclude Bot Runner from antivirus checks

In some cases, due to various settings, antiviruses do not trust third-party applications and block them. If the ElectoNeek platform does not start, one of the possible reasons could be that it is blocked by an antivirus. In this case, we recommend you to contact your system administrator to add certain files to the antivirus exception list. Below you will find a list of files for "Bot Runner".

  • C:\Program Files\ElectroNeek Robot\ElectroNeek Bot Runner.exe
  • C:\Program Files\ElectroNeek Robot\win-agent-selectors\ElectroNeek-Robot.exe
  • C:\Program Files\ElectroNeek Robot\Loader\ElectroNeek-loader.exe
⬅️


How to silently install Bot Runner and connect it to Orchestrator

In some scenarios, you might require the installation of Bot Runner in "silent mode", that is, without requiring the use of the installer's graphical interface. This is a common request when dealing with large-scale architectures, in which you might need to install (or update) Bot Runner in multiple machines. Doing so manually could take a lot of valuable time, so we're providing a method to perform the installation with a simple command, as well as a way to connect the recently-installed Bot Runner to an Orchestrator programatically. Finally, we'll provide an integrated solution to do all of these steps in sequence.

Install Bot Runner using a command

🚧

Important

Make sure to set the PowerShell execution policy accordingly before running PowerShell scripts on a machine. For example, you may use the following command before running any script:

 Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process

In order to install the Bot Runner application on a machine using a command, you first must download the Bot Runner installer, and place it on a folder of your choosing.

Next, open a PowerShell terminal as Administrator.

In the PowerShell terminal, run the following command:

Start-Process -FilePath "[installer path]" -ArgumentList "/exenoui /quiet /norestart" -Wait -PassThru -Verb RunAs

This command executes the Bot Runner installer "silently", without any graphical user interface, and with Administrator permissions (which are required for the installation.)

Connect Bot Runner to Orchestrator using commands

📘

Before following the steps in this section, make you sure you are familiar with Token Connections in Orchestrator. You can read the following article for more information: Orchestrator SaaS Connection - Token Connection

After installing Bot Runner, you may want to programatically connect it to Orchestrator using a Token, without needing to manually open the application and pasting the Token. You can do so with some more PowerShell commands, which will perform the following steps:

  1. Create the Bot Runner license file (AppData\Roaming\ElectroNeek\electroneek_license_key_3.0)
  2. Fill the license file with a Token previously generated in Orchestrator
  3. Close and restart the Bot Runner application, so that the Token is registered

These tasks can be performed with the following commands:

# Delete the Bot Runner license file (if it exists -- if Bot Runner was installed for the first time, it will not exist, and you can skip this command)
Remove-Item "C:\Users\[username]\AppData\Roaming\ElectroNeek\electroneek_license_key_3.0" -Force

# Create the Bot Runner license file with the Token as its content
Set-Content -Path "C:\Users\[username]\AppData\Roaming\ElectroNeek\electroneek_license_key_3.0" -Value "[your full Token from Orchestrator]" -Force -NoNewLine

# Stop the ElectroNeek Bot Runner processes
Stop-Process -Name "ElectroNeek Bot Runner" -Force -ErrorAction Stop

# Start the ElectroNeek Bot Runner process again
Start-Process cmd.exe -ArgumentList "/c `"C:\Program Files\ElectroNeek Robot\ElectroNeek Bot Runner.exe`"" -WindowStyle Hidden

The last command opens Bot Runner through an instance of the Windows Command Prompt (cmd) in order to make the new Bot Runner process independent from the PowerShell terminal. If you used a simpler command to launch the application directly from PowerShell (such as Start-Process -FilePath "C:\Program Files\ElectroNeek Robot\ElectroNeek Bot Runner.exe"), the Bot Runner application would close when you close the PowerShell terminal.

After you've performed these steps, you will still need to approve the Bot Runner in the Orchestrator's "Bot Runners" page. This step cannot be automated, as it is a mandatory security step required to allow a Bot Runner to operate within an Orchestrator. However, this step doesn't need to be done within the Bot Runner machine, and can be performed in the ElectroNeek Portal with a web browser on any machine.

Performing silent installation and token connection of Bot Runner at once

🚧

Important

Make sure to set the PowerShell execution policy accordingly before running PowerShell scripts on a machine. For example, you may use the following command before running any script:

 Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process

We have prepared the following PowerShell script that can be used for installing and connecting Bot Runner on any machine with 3 simple parameters:

  • InstallerPath = Path to the pre-downloaded Bot Runner installer (in .EXE format)
  • LicenseToken = The full connection Token generated in Orchestrator
  • TargetUsername = (Optional) The Windows user name. If not provided, the script will attempt to identify it automatically.
<#
.SYNOPSIS
    Installs ElectroNeek Bot Runner and configures license key
.DESCRIPTION
    This script installs ElectroNeek Bot Runner, replaces the license key file,
    and restarts the application. Suitable for deployment via RMM tools.
.PARAMETER InstallerPath
    Full path to the ElectroNeek Bot Runner installer EXE file
.PARAMETER LicenseToken
    The license token string to write to the license key file
.PARAMETER TargetUsername
    Optional: Specific username to target. If not provided, attempts to find the user automatically.
.EXAMPLE
    .\Install-ElectroNeek.ps1 -InstallerPath "C:\Temp\setup.exe" -LicenseToken "your-token-here"
.EXAMPLE
    .\Install-ElectroNeek.ps1 -InstallerPath "C:\Temp\setup.exe" -LicenseToken "abc123" -TargetUsername "jsmith"
#>

param(
    [Parameter(Mandatory=$true)]
    [string]$InstallerPath,
    
    [Parameter(Mandatory=$true)]
    [string]$LicenseToken,
    
    [Parameter(Mandatory=$false)]
    [string]$TargetUsername = ""
)

# Constants
$APP_PROCESS_NAME = "ElectroNeek Bot Runner"
$APP_EXE_PATH = "C:\Program Files\ElectroNeek Robot\ElectroNeek Bot Runner.exe"

# Function to write log messages
function Write-Log {
    param([string]$Message, [string]$Level = "INFO")
    $timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
    Write-Host "[$timestamp] [$Level] $Message"
}

# Function to install application
function Install-Application {
    param([string]$ExePath)
    
    Write-Log "Starting silent installation of: $ExePath"
    
    if (-not (Test-Path $ExePath)) {
        Write-Log "ERROR: Installer not found at path: $ExePath" -Level "ERROR"
        return $false
    }
    
    try {
        # Using /exenoui /quiet /norestart for completely silent installation
        # -Verb RunAs elevates to admin without prompting (requires script to run as admin)
        $process = Start-Process -FilePath $ExePath -ArgumentList "/exenoui /quiet /norestart" -Wait -PassThru -Verb RunAs
        
        Write-Log "Installation process completed with exit code: $($process.ExitCode)"
        
        # Wait additional time for installation to fully complete
        Start-Sleep -Seconds 5
        
        return $true
    }
    catch {
        Write-Log "ERROR during installation: $_" -Level "ERROR"
        return $false
    }
}

# Function to get target user directory
function Get-TargetUserPath {
    param([string]$Username)
    
    if ($Username -ne "") {
        $userPath = "C:\Users\$Username"
        if (Test-Path $userPath) {
            Write-Log "Using specified username: $Username"
            return $userPath
        } else {
            Write-Log "Specified user path not found: $userPath" -Level "WARNING"
        }
    }
    
    # Try to find the most recently modified user profile (excluding system accounts)
    $excludedUsers = @("Public", "Default", "Default User", "All Users")
    $userProfiles = Get-ChildItem "C:\Users" -Directory | 
        Where-Object { $excludedUsers -notcontains $_.Name } |
        Sort-Object LastWriteTime -Descending |
        Select-Object -First 1
    
    if ($userProfiles) {
        Write-Log "Auto-detected user: $($userProfiles.Name)"
        return $userProfiles.FullName
    }
    
    Write-Log "ERROR: Could not determine target user directory" -Level "ERROR"
    return $null
}

# Function to handle license key file
function Set-LicenseKey {
    param(
        [string]$UserPath,
        [string]$Token
    )
    
    $licenseFilePath = Join-Path $UserPath "AppData\Roaming\ElectroNeek\electroneek_license_key_3.0"
    $licenseDir = Split-Path $licenseFilePath -Parent
    
    Write-Log "Target license file path: $licenseFilePath"
    
    # Step 2: Check and delete existing file if it exists
    if (Test-Path $licenseFilePath) {
        try {
            Remove-Item $licenseFilePath -Force
            Write-Log "Deleted existing license file"
        }
        catch {
            Write-Log "ERROR deleting license file: $_" -Level "ERROR"
            return $false
        }
    } else {
        Write-Log "No existing license file found - skipping deletion step"
    }
    
    # Step 3: Ensure directory exists
    if (-not (Test-Path $licenseDir)) {
        try {
            New-Item -ItemType Directory -Path $licenseDir -Force | Out-Null
            Write-Log "Created directory: $licenseDir"
        }
        catch {
            Write-Log "ERROR creating directory: $_" -Level "ERROR"
            return $false
        }
    }
    
    # Step 3: Create new license file with token
    try {
        Set-Content -Path $licenseFilePath -Value $Token -Force -NoNewline
        Write-Log "Successfully created license file with token"
        
        # Verify the file was created
        if (Test-Path $licenseFilePath) {
            $content = Get-Content $licenseFilePath -Raw
            Write-Log "License file verified. Content length: $($content.Length) characters"
            return $true
        } else {
            Write-Log "ERROR: License file was not created" -Level "ERROR"
            return $false
        }
    }
    catch {
        Write-Log "ERROR creating license file: $_" -Level "ERROR"
        return $false
    }
}

# Function to stop all instances of ElectroNeek Bot Runner
function Stop-ElectroNeekProcess {
    Write-Log "Checking for running ElectroNeek Bot Runner processes..."
    
    try {
        $processes = Get-Process -Name "ElectroNeek Bot Runner" -ErrorAction SilentlyContinue
        
        if ($processes) {
            Write-Log "Found $($processes.Count) running instance(s). Stopping..."
            Stop-Process -Name "ElectroNeek Bot Runner" -Force -ErrorAction Stop
            
            # Wait a moment to ensure processes are fully terminated
            Start-Sleep -Seconds 2
            Write-Log "All ElectroNeek Bot Runner processes stopped"
        } else {
            Write-Log "No running ElectroNeek Bot Runner processes found"
        }
        
        return $true
    }
    catch {
        Write-Log "ERROR while stopping processes: $_" -Level "ERROR"
        return $false
    }
}

# Function to start ElectroNeek Bot Runner
function Start-ElectroNeekProcess {
    Write-Log "Starting ElectroNeek Bot Runner from: $APP_EXE_PATH"
    
    if (-not (Test-Path $APP_EXE_PATH)) {
        Write-Log "ERROR: ElectroNeek Bot Runner executable not found at: $APP_EXE_PATH" -Level "ERROR"
        return $false
    }
    
    try {
        # Create a temporary VBS script to launch the app hidden and independently
        $vbsScript = @"
Set objShell = CreateObject("WScript.Shell")
objShell.Run """$APP_EXE_PATH""", 0, False
"@
        $vbsPath = "$env:TEMP\StartElectroNeek.vbs"
        Set-Content -Path $vbsPath -Value $vbsScript -Force
        
        # Run the VBS script and then delete it
        Start-Process wscript.exe -ArgumentList "`"$vbsPath`"" -WindowStyle Hidden
        Start-Sleep -Seconds 1
        Remove-Item $vbsPath -Force -ErrorAction SilentlyContinue
        
        Write-Log "ElectroNeek Bot Runner started successfully"
        return $true
    }
    catch {
        Write-Log "ERROR starting ElectroNeek Bot Runner: $_" -Level "ERROR"
        return $false
    }
}

# Main execution
Write-Log "=========================================="
Write-Log "ElectroNeek Bot Runner Installation & Configuration"
Write-Log "=========================================="

# Step 1: Install the application
Write-Log "STEP 1: Installing ElectroNeek Bot Runner..."
$installSuccess = Install-Application -ExePath $InstallerPath

if (-not $installSuccess) {
    Write-Log "Installation failed. Exiting." -Level "ERROR"
    exit 1
}

# Get user path for license operations
$userPath = Get-TargetUserPath -Username $TargetUsername

if ($null -eq $userPath) {
    Write-Log "Could not determine user path. Exiting." -Level "ERROR"
    exit 1
}

# Steps 2 & 3: Handle license key file
Write-Log "STEPS 2 & 3: Managing license key file..."
$licenseSuccess = Set-LicenseKey -UserPath $userPath -Token $LicenseToken

if (-not $licenseSuccess) {
    Write-Log "License key configuration failed. Exiting." -Level "ERROR"
    exit 1
}

# Step 4: Stop all running instances
Write-Log "STEP 4a: Stopping ElectroNeek Bot Runner processes..."
$stopSuccess = Stop-ElectroNeekProcess

if (-not $stopSuccess) {
    Write-Log "Warning: Issues encountered while stopping processes, but continuing..." -Level "WARNING"
}

# Step 4: Start the application
Write-Log "STEP 4b: Starting ElectroNeek Bot Runner..."
$startSuccess = Start-ElectroNeekProcess

if (-not $startSuccess) {
    Write-Log "Failed to start ElectroNeek Bot Runner. Exiting." -Level "ERROR"
    exit 1
}

Write-Log "=========================================="
Write-Log "All steps completed successfully!"
Write-Log "=========================================="
exit 0

You can save this script to a file called Install-Electroneek.ps1, and run it by using following command, in an Administrator PowerShell terminal:

.\Install-ElectroNeek.ps1 -InstallerPath "[full path to the Bot Runner installer]" -TargetUsername "[Windows user name, if left empty will auto-detect]" -LicenseToken "[the full Token from Orchestrator]"

You will see several console messages in the PowerShell terminal, indicating that it's working as expected, or reporting any errors that might occur.


⬅️