CoCoineticCoinetic for MSPs

Deploy Coinetic AI Security with NinjaOne

For MSPs and IT teams that manage Windows Servers and PCs with NinjaOne: one PowerShell script in your Automation Library installs Coinetic AI Security silently, takes each customer's license key from a script variable or a custom field, and tells NinjaOne exactly what happened.

In short
  • Add the script below to the NinjaOne Automation Library as a PowerShell script for Windows that runs as System.
  • Give it the customer's key: a script variable coineticLicenseKey, or a custom field with that name (Secure fields work).
  • Run it on one device, then schedule it in a policy for the customer's devices. Exit code 0 = done.
  • Computers that already have Coinetic AI Security are skipped; it updates itself, so no update job is needed.

Who this is for

IT service providers and administrators who use NinjaOne and want Coinetic AI Security on many Windows Servers and PCs without touching each one. For Group Policy, Intune or any other RMM tool, see the general deployment guide.

What the script does

  1. Checks that it runs as SYSTEM or administrator and that Windows is supported.
  2. Skips computers that already have Coinetic AI Security (exit code 0) - the installed Coinetic updates itself, so no recurring update job is needed. A repair / update run can be forced.
  3. Reads the license key from a NinjaOne script variable or custom field - never from the script text. The log shows only the key's last 5 characters.
  4. Downloads the installer from https://coinetic.io/download/CoineticSetup.exe into a new, empty temp folder.
  5. Runs it only if it is validly signed by Salus Alpha Group AG. Anything else is deleted and nothing is run (exit code 13).
  6. Installs with CoineticSetup.exe /quiet /key=CNT-... /accepteula. The installer checks the key online before it installs anything.
  7. Hands the exit code back to NinjaOne and writes a log to %SystemRoot%\Temp\coinetic-rmm-deploy.log.

1. Before you start

2. Add the script to the Automation Library

  1. In NinjaOne, create a new script in the Automation Library.
  2. Name it, for example, Install Coinetic AI Security. Choose PowerShell as the language and Windows as the operating system, for all architectures, and let it run as System.
  3. Paste the full script from section 6 into the script editor and save it.

3. Script variables

NinjaOne passes script variables to the script as environment variables while it runs. Add the ones you need (all optional - but without a key or the trial the script installs nothing). Give each variable exactly the name below, without spaces, and check that its Calculated name is the same; the script reads them as $env:coineticLicenseKey and so on.

VariableTypeWhat it does
coineticLicenseKeyTextThe customer's license key CNT-XXXXX-XXXXX-XXXXX-XXXXX. Wins over the custom field.
coineticTrialCheckboxNo key: start the free 30-day trial instead.
coineticDefaultViewDropdown: simple, fullThe view all users of the computer see first: the Simple view for end users, the Full view for you.
coineticRepairCheckboxRun the installer even if Coinetic AI Security is installed (update / repair).
coineticKeyFieldTextThe name of the custom field to read the key from, if it is not coineticLicenseKey.

4. Keep the key in a custom field (recommended)

A key typed into a script variable has to be entered at every run. A custom field keeps it with the customer:

  1. Create a custom field named coineticLicenseKey (or your own name - then set coineticKeyField). A Secure field is a good choice: NinjaOne gives automations access to secure fields while they run, and the web or local terminal cannot read them.
  2. Let automations read the field, and fill in each customer's key where the field applies to that customer's devices.
  3. The script reads it with Get-NinjaProperty (or Ninja-Property-Get on older agents). A script variable coineticLicenseKey, if set, wins over the field.

Run the script once on a test device and look for the line Licence key from the custom field coineticLicenseKey (ends with XXXXX) in its output - it shows that the field is read.

5. Run it on a schedule

  1. Test first: run the script once on one device as an automation and check the result (section 8).
  2. Roll out: add the script as a scheduled task in the policy that covers the customer's Windows devices, or as a global scheduled task for a set of devices.
  3. The schedule can stay on: computers that already have Coinetic AI Security are skipped with exit code 0, so new computers get it on the next run.

Treat any exit code other than 0 as a failure in your alerting - the table in section 7 says what each code means.

6. The script

Copy it as it is - nothing to replace inside. Free to use and adapt for deploying Coinetic AI Security.

<#
.SYNOPSIS
    Deploy Coinetic AI Security silently from NinjaOne (runs as SYSTEM).
    Coinetic AI Security - https://coinetic.io

.DESCRIPTION
    Downloads the official installer from https://coinetic.io/download/CoineticSetup.exe,
    checks that it is validly Authenticode-signed by Salus Alpha Group AG, and runs
        CoineticSetup.exe /quiet /key=<licence key> /accepteula
    The installer checks the licence key online before it installs anything.

    Idempotent: a computer that already has Coinetic AI Security is skipped (exit 0) -
    the installed Coinetic updates itself, no RMM job is needed after the first installation.
    Set the script variable "coineticRepair" to run the installer anyway (update / repair).

    Licence key - never hard-coded in this script. The first one found wins:
      1. Script variable  coineticLicenseKey   (NinjaOne passes it as $env:coineticLicenseKey)
      2. Custom field     coineticLicenseKey   (or the field named in the script variable
                                                coineticKeyField; a Global field set at
                                                organisation level reaches all its devices;
                                                a Secure field works too)
    Without a key, set the checkbox variable "coineticTrial" to start the free 30-day trial
    instead (all features, no payment details).

    Optional script variables
      coineticDefaultView   simple | full   - which view all users of the computer see first
      coineticRepair        true            - run the installer even if Coinetic is installed

    Requirements: Windows 7 SP1 / Server 2008 R2 SP1 up to Windows 11 / Server 2025, 32- or 64-bit,
    any Windows language. Windows PowerShell 2.0 or later (5.1 recommended). Run as SYSTEM or
    administrator. The computer needs relayer.coinetic.io on TCP 443 (licence check, direct
    connection, not through a web proxy) and coinetic.io (download, later updates).

    Exit codes
      0    Coinetic AI Security is installed (or was already installed) and the protection is running
      1    Setup failed - see C:\ProgramData\Coinetic\setup.log on the computer
      3    Licence key not valid, or no valid licence - nothing installed
      5    First installation without /accepteula - nothing installed (should not happen with this script)
      740  Not run as administrator or SYSTEM - nothing changed
      10   No licence key found and trial not selected, or the key has an unexpected format
      11   Windows version not supported (Windows 7 SP1 / Server 2008 R2 SP1 or later needed)
      12   Download failed
      13   Signature check failed - the downloaded file was deleted, nothing was run
      14   Another Coinetic setup is already running - try again later
      15   The installer could not be started

    Log: Write-Output (shown in the NinjaOne activity) and %SystemRoot%\Temp\coinetic-rmm-deploy.log.
    The licence key is never logged - only its last 5 characters.

.NOTES
    Coinetic AI Security - https://coinetic.io   |   questions: office@coinetic.io
    Deployment guide: https://coinetic.io/deploy-ninjaone  (all options: https://coinetic.io/deploy-coinetic)
    Free to use and adapt for deploying Coinetic AI Security. Provided AS IS, without warranty of any
    kind; to the maximum extent permitted by law, no liability (see https://coinetic.io/eula, sections 7 and 8).
    Test on one computer before you roll it out.
#>

# ---------------------------------------------------------------------------------------------
# Settings (the defaults are fine for most MSPs)
# ---------------------------------------------------------------------------------------------
$DownloadUrl  = 'https://coinetic.io/download/CoineticSetup.exe'
$SignerOrg    = 'Salus Alpha Group AG'
$DefaultField = 'coineticLicenseKey'
$LogFile      = Join-Path $env:SystemRoot 'Temp\coinetic-rmm-deploy.log'

# ---------------------------------------------------------------------------------------------
# Helpers (PowerShell 2.0 compatible; no parsing of localized command output)
# ---------------------------------------------------------------------------------------------
$Inv = [System.Globalization.CultureInfo]::InvariantCulture

function Write-Log([string]$Message) {
    $line = (Get-Date).ToUniversalTime().ToString('yyyy-MM-dd HH:mm:ss', $Inv) + 'Z  ' + $Message
    Write-Output $line
    try { Add-Content -Path $LogFile -Value $line -Encoding UTF8 -ErrorAction Stop } catch { }
}

function Test-True([string]$Value) {
    if ($Value -eq $null) { return $false }
    $v = $Value.Trim().ToLowerInvariant()
    return ($v -eq 'true' -or $v -eq '1' -or $v -eq 'yes')
}

function Get-Text([object]$Value) {
    if ($Value -eq $null) { return '' }
    return ([string]$Value).Trim()
}

function Get-ProgramFiles64 {
    # 32-bit PowerShell on 64-bit Windows: ProgramW6432 points to the real "Program Files"
    if ($env:ProgramW6432) { return $env:ProgramW6432 }
    return $env:ProgramFiles
}

function Test-CoineticInstalled {
    $exe = Join-Path (Get-ProgramFiles64) 'Coinetic\Coinetic.exe'
    if (-not (Test-Path -LiteralPath $exe)) { return $false }
    # In a 64-bit (or 32-bit-on-32-bit) process the uninstall key is visible too; it is gone
    # right after an uninstall, while Coinetic.exe deletes itself a few seconds later.
    $wow = ([IntPtr]::Size -eq 4) -and ($env:PROCESSOR_ARCHITEW6432)
    if (-not $wow) {
        return (Test-Path -LiteralPath 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Coinetic')
    }
    return $true
}

function Get-NinjaField([string]$Name) {
    # Custom fields (Secure fields too) can only be read while NinjaOne runs the script as an automation,
    # not in the web or local terminal. Each command is tried on its own, so a failing one cannot hide the other.
    $v = ''
    if (Get-Command -Name 'Get-NinjaProperty' -ErrorAction SilentlyContinue) {
        try { $v = Get-Text (Get-NinjaProperty -Name $Name -ErrorAction Stop) } catch { $v = '' }
    }
    if ($v -eq '' -and (Get-Command -Name 'Ninja-Property-Get' -ErrorAction SilentlyContinue)) {
        # the original command (older agents)
        try { $v = Get-Text (Ninja-Property-Get $Name) } catch { $v = '' }
    }
    return $v
}

function Set-DefaultView([string]$View) {
    # Same as https://coinetic.io/deploy-coinetic section 7: keeps every other line of engine.ini
    $ini  = Join-Path $env:ProgramData 'Coinetic\engine.ini'
    $utf8 = New-Object System.Text.UTF8Encoding($false)
    $lines = @()
    if (Test-Path -LiteralPath $ini) {
        $lines = @([System.IO.File]::ReadAllLines($ini, $utf8) | Where-Object { $_ -notmatch '^\s*DefaultView\s*=' })
    }
    $lines += "DefaultView=$View"
    [System.IO.File]::WriteAllLines($ini, [string[]]$lines, $utf8)
}

# ---------------------------------------------------------------------------------------------
# 1. Checks before anything is downloaded
# ---------------------------------------------------------------------------------------------
Write-Log 'Coinetic AI Security - RMM deployment (NinjaOne) started.'

$principal = New-Object System.Security.Principal.WindowsPrincipal([System.Security.Principal.WindowsIdentity]::GetCurrent())
if (-not $principal.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)) {
    Write-Log 'Not run as administrator or SYSTEM - nothing changed. In NinjaOne choose "Run As: System".'
    exit 740
}

$os = [System.Environment]::OSVersion.Version
if ($os -lt (New-Object System.Version 6, 1, 7601)) {
    Write-Log "Windows version $os is not supported - Windows 7 SP1 / Server 2008 R2 SP1 or later is needed."
    exit 11
}

$repair = Test-True $env:coineticRepair
$view   = (Get-Text $env:coineticDefaultView).ToLowerInvariant()
if ($view -ne '' -and $view -ne 'simple' -and $view -ne 'full') {
    Write-Log "coineticDefaultView '$view' ignored - use simple or full."
    $view = ''
}

if ((Test-CoineticInstalled) -and -not $repair) {
    Write-Log 'Coinetic AI Security is already installed - nothing to do (it updates itself).'
    if ($view -ne '') {
        try { Set-DefaultView $view; Write-Log "Start view set to $view." } catch { Write-Log "Could not set the start view: $($_.Exception.Message)" }
    }
    exit 0
}

if (Get-Process -Name 'CoineticSetup' -ErrorAction SilentlyContinue) {
    Write-Log 'Another Coinetic setup is running on this computer - try again later.'
    exit 14
}

# Licence key: script variable first, then the custom field
$key = Get-Text $env:coineticLicenseKey
$source = 'script variable coineticLicenseKey'
if ($key -eq '') {
    $field = Get-Text $env:coineticKeyField
    if ($field -eq '') { $field = $DefaultField }
    $key = Get-NinjaField $field
    $source = "custom field $field"
}
$trial = Test-True $env:coineticTrial

$setupArgs = @('/quiet', '/accepteula')
if ($key -ne '') {
    # Only plain key characters - nothing that could add a switch or break the command line
    if ($key.Length -gt 64 -or $key -notmatch '^CNT-[A-Za-z0-9-]+$') {
        Write-Log "The licence key from the $source does not look like CNT-XXXXX-XXXXX-XXXXX-XXXXX - nothing installed."
        exit 10
    }
    $setupArgs += "/key=$key"
    $tail = $key.Substring([Math]::Max(0, $key.Length - 5))
    Write-Log "Licence key from the $source (ends with $tail)."
} elseif ($trial) {
    $setupArgs += '/trial'
    Write-Log 'No licence key - starting the free 30-day trial (coineticTrial is set).'
} elseif ($repair -and (Test-CoineticInstalled)) {
    Write-Log 'Repair / update without a key (works only where a valid licence is already on this computer).'
} else {
    Write-Log 'No licence key found. Set the script variable or custom field coineticLicenseKey, or tick coineticTrial.'
    exit 10
}

# ---------------------------------------------------------------------------------------------
# 2. Download into a new, empty folder
# ---------------------------------------------------------------------------------------------
$work = Join-Path $env:TEMP ('CoineticDeploy-' + [Guid]::NewGuid().ToString('N'))
$file = Join-Path $work 'CoineticSetup.exe'
try { New-Item -ItemType Directory -Path $work -Force -ErrorAction Stop | Out-Null } catch {
    Write-Log "Could not create the temp folder $work : $($_.Exception.Message)"
    exit 12
}

# TLS 1.2 for older Windows (ignored where it is already the default)
try { [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor 3072 } catch { }

Write-Log "Downloading $DownloadUrl"
try {
    (New-Object System.Net.WebClient).DownloadFile($DownloadUrl, $file)
} catch {
    Write-Log "Download failed: $($_.Exception.Message)"
    Remove-Item -LiteralPath $work -Recurse -Force -ErrorAction SilentlyContinue
    exit 12
}

# ---------------------------------------------------------------------------------------------
# 3. Run only a file that is validly signed by Salus Alpha Group AG
# ---------------------------------------------------------------------------------------------
$sig = Get-AuthenticodeSignature -FilePath $file
$subject = ''
if ($sig.SignerCertificate) { $subject = $sig.SignerCertificate.Subject }
if ($sig.Status -ne 'Valid' -or $subject -notmatch ('(^|,\s*)O="?' + [regex]::Escape($SignerOrg) + '"?(,|$)')) {
    Write-Log "Signature check failed: status $($sig.Status), signer '$subject'. The file was deleted, nothing was run."
    Remove-Item -LiteralPath $work -Recurse -Force -ErrorAction SilentlyContinue
    exit 13
}
Write-Log "Signature valid: $subject"

# ---------------------------------------------------------------------------------------------
# 4. Install
# ---------------------------------------------------------------------------------------------
Write-Log ('Running CoineticSetup.exe ' + ((@($setupArgs) | ForEach-Object { if ($_ -like '/key=*') { '/key=...' + $_.Substring([Math]::Max(5, $_.Length - 5)) } else { $_ } }) -join ' '))
try {
    $p = Start-Process -FilePath $file -ArgumentList $setupArgs -Wait -PassThru -ErrorAction Stop
    $code = $p.ExitCode
    if ($code -eq $null) { $code = 1 }   # never report success when Windows did not hand back an exit code
} catch {
    Write-Log "The installer could not be started: $($_.Exception.Message)"
    Remove-Item -LiteralPath $work -Recurse -Force -ErrorAction SilentlyContinue
    exit 15
}
Remove-Item -LiteralPath $work -Recurse -Force -ErrorAction SilentlyContinue

switch ($code) {
    0       { Write-Log 'Coinetic AI Security installed - the protection is running.' }
    3       { Write-Log 'Licence key not valid, or no valid licence - nothing installed. Check the key in the partner area and that relayer.coinetic.io is reachable on TCP 443.' }
    5       { Write-Log 'First installation needs /accepteula - nothing installed.' }
    740     { Write-Log 'Not run as administrator or SYSTEM - nothing changed.' }
    default { Write-Log "Setup failed (exit code $code) - see C:\ProgramData\Coinetic\setup.log" }
}

if ($code -eq 0 -and $view -ne '') {
    try { Set-DefaultView $view; Write-Log "Start view set to $view." } catch { Write-Log "Could not set the start view: $($_.Exception.Message)" }
}

exit $code

7. Exit codes

CodeMeaningWhat to do
0Done - Coinetic AI Security is installed (or was already installed) and the protection is running.Nothing.
1Setup failed.Read C:\ProgramData\Coinetic\setup.log on that computer.
3The license key is not valid, or there is no valid license on this computer. Nothing installed.Check the key, its computer count and validity in your partner area, and that the computer reaches relayer.coinetic.io on TCP 443.
5First installation without /accepteula. Nothing installed.Should not happen - the script always passes it. Write to us.
740Not run as administrator or SYSTEM. Nothing changed.Run the script as SYSTEM.
10No license key found and no trial selected, or the key does not look like CNT-....Set the variable or custom field coineticLicenseKey, or tick coineticTrial.
11Windows older than Windows 7 SP1 / Server 2008 R2 SP1.Not supported.
12The download failed.Check internet access and any proxy to coinetic.io.
13The signature check failed. The file was deleted, nothing was run.Check for TLS inspection or a proxy that changes downloads; write to us.
14Another Coinetic setup is already running on this computer.Run the script again later.
15The installer could not be started.See the log line; check the logs of your endpoint protection.

Codes 0, 1, 3, 5 and 740 come from the installer (see the deployment guide); 10 to 15 come from the script.

The script writes every step to its output in NinjaOne and to %SystemRoot%\Temp\coinetic-rmm-deploy.log on the computer.

8. How to verify

To check many computers at once, this line returns True where Coinetic AI Security is installed (PowerShell, as SYSTEM or administrator):

Test-Path -LiteralPath (Join-Path $(if ($env:ProgramW6432) { $env:ProgramW6432 } else { $env:ProgramFiles }) 'Coinetic\Coinetic.exe')

9. After the rollout

Not a partner yet?

Resellers get 25 % off every license they buy for their customers - volume prices from 250 computers on request - on every renewal. Approved resellers get a free NFR license (not for resale) for their own computers - to run Coinetic AI Security in their office and show it to customers. Coinetic for IT service providers and MSPs →

Or try it first: 30 days free, all features, no payment details →

Frequently asked

Where does the script get the license key from?

From the script variable coineticLicenseKey if it is set, otherwise from the custom field coineticLicenseKey (or the field named in coineticKeyField). The key is never written into the script, and the log shows only its last 5 characters.

Do Secure custom fields work?

Yes. NinjaOne gives automations access to secure custom fields while they run. They cannot be read from the web or local terminal, so test the script as an automation, not in a terminal.

Why does the script end with exit code 10?

It found no license key and the trial was not selected, or the key does not look like CNT-XXXXX-XXXXX-XXXXX-XXXXX. Check the variable or custom field name, and that the field has a value for that device.

Do I have to push updates with NinjaOne?

No. The installed Coinetic AI Security updates itself and installs only updates signed by Salus Alpha Group AG. NinjaOne is needed only for the first installation.

Can I leave the script on a schedule?

Yes. Computers that already have Coinetic AI Security are skipped with exit code 0, so a recurring run only installs it on new computers.

Why does the script end with exit code 13?

The downloaded file was not validly signed by Salus Alpha Group AG, so the script deleted it and ran nothing. This usually means a proxy or TLS inspection changed the download. Write to office@coinetic.io if it keeps happening.

How do I uninstall Coinetic AI Security silently?

Run "C:\Program Files\Coinetic\Coinetic.exe" /uninstall /quiet /code=<uninstall code> as SYSTEM (or /pw=<password> if you set an uninstall password). The uninstall code is made for that one computer and valid for 7 days - ask for it at office@coinetic.io. Without it nothing is removed (exit code 6) and the attempt is reported. Details in the deployment guide.

Can I change the script?

Yes, it is free to use and adapt for deploying Coinetic AI Security. Keep the signature check: it makes sure only our installer runs on your customers' computers.

NinjaOne is a trademark of its owner; it is named here only to say which tool this guide is for. Menu names can change - see NinjaOne's own documentation on script variables and custom fields in scripts.

This guide is general information, provided "as is" without warranty, and we accept no liability for its use to the maximum extent permitted by law; see sections 7 and 8 of the license agreement. Test every change on one computer first.

Coinetic AI Security - https://coinetic.io