Skip to main content

Install - Ninja Agent

Summary

This script deploys the NinjaRMM Agent to Windows and Mac OS.
It requires an Authorization token which needs to be stored under the managed variable "Ninja_TokenID".

Sample Run

To run the script, first fill the managed variable with the appropriate token which can be obtained from the Ninja Portal. The managed variable name is "Ninja_TokenID". To run the script, use the method below.

Image

Image

Image

Dependencies

  • Managed Variable: Ninja_TokenID
  • Download URL for both Mac and Windows.

Variables

NameDescription
Dir for MAC/Library/Kaseya/_automation/AgentProcedure/NinjaInstallation
Dir for Windows%ProgramData%_automation\AgentProcedure\NinjaInstallation
Ninja_TokenIDThis stores the Token required during the Ninja Agent installation.
#global:cmdresults#Stores command results to check progress or errors.

Managed Files

None

Output

TimeProcedureStatusUser
3:40:41 am 9-Oct-25Install - Ninja AgentSuccess THENProNoc
3:40:41 am 9-Oct-25Ninja Agent Installer-0004Success ELSEProNoc
3:40:41 am 9-Oct-25Ninja Agent Installer-0001Success THENProNoc
3:40:41 am 9-Oct-25Ninja Agent Installer-0002Success THENProNoc
3:40:41 am 9-Oct-25Ninja Agent Installer-0003Success THENProNoc
3:40:41 am 9-Oct-25Ninja Agent Installer-0003Ninja agent installed successfully.ProNoc
3:40:41 am 9-Oct-25Ninja Agent Installer-0002NinjaRMMAgentProNoc
3:40:41 am 9-Oct-25Execute Shell command - Get Results to VariableSuccess THENProNoc
3:40:41 am 9-Oct-25Execute Shell command - Get Results to Variable-0001Success THENProNoc
3:40:41 am 9-Oct-25Execute Shell command - Get Results to Variable-0010Success THENProNoc
3:40:39 am 9-Oct-25Execute Shell command - Get Results to Variable-0002Success THENProNoc
3:40:39 am 9-Oct-25Execute Shell command - Get Results to Variable-0003Success THENProNoc
3:40:39 am 9-Oct-25Execute Shell command - Get Results to Variable-0004Success THENProNoc
3:40:39 am 9-Oct-25Execute Shell command - Get Results to Variable-0005Success ELSEProNoc
3:40:39 am 9-Oct-25Execute Shell command - Get Results to Variable-0005Executing command in 64-bit shell as system: powershell.exe -ExecutionPolicy Bypass -Command "Get-ItemProperty 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*','HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*' -ErrorAction SilentlyContinue | Where-Object { "$_.DisplayName -eq 'NinjaRMMAgent'" } | Select-Object -ExpandProperty DisplayName -ErrorAction SilentlyContinue" >"c:\kworking\commandresults-1636964856.txt" 2>&1ProNoc
3:40:38 am 9-Oct-25Ninja Agent Installer-0002msiexec.exe -i "%ProgramData%_automation\AgentProcedure\NinjaInstallation/NinjaOneAgent-x86.msi" TOKENID="N122315212122"ProNoc
3:40:36 am 9-Oct-25Ninja Agent Installer-0002File downloaded successfully.ProNoc
3:40:33 am 9-Oct-25Execute Powershell CommandSuccess THENProNoc
3:40:33 am 9-Oct-25Execute Powershell Command-0001Success THENProNoc
3:40:33 am 9-Oct-25Execute Powershell Command-0002Success THENProNoc
3:40:33 am 9-Oct-25Execute Powershell Command-0011Success THENProNoc
3:40:33 am 9-Oct-25Execute Powershell Command-0012Success ELSEProNoc
3:40:32 am 9-Oct-25Execute Powershell Command-0011Powershell command completed!ProNoc
3:40:30 am 9-Oct-25Execute Powershell Command-0011New-Item -Type Directory -Path $env:ProgramData_automation\AgentProcedure -Name NinjaInstallationProNoc
3:40:30 am 9-Oct-25Execute Powershell Command-0009Success THENProNoc
3:40:30 am 9-Oct-25Execute Powershell Command-0010Success ELSEProNoc
3:40:30 am 9-Oct-25Execute Powershell Command-0010Not sending output to variable.ProNoc
3:40:30 am 9-Oct-25Execute Powershell Command-0007Success THENProNoc
3:40:30 am 9-Oct-25Execute Powershell Command-0008Success THENProNoc
3:40:30 am 9-Oct-25Execute Powershell Command-0008New command variable: New-Item -Type Directory -Path $env:ProgramData_automation\AgentProcedure -Name NinjaInstallationProNoc
3:40:30 am 9-Oct-25Execute Powershell Command-0008Custom commands detected as New-Item -Type Directory -Path $env:ProgramData_automation\AgentProcedure -Name NinjaInstallationProNoc
3:40:30 am 9-Oct-25Execute Powershell Command-0003Success THENProNoc
3:40:30 am 9-Oct-25Execute Powershell Command-0004Success ELSEProNoc
3:40:27 am 9-Oct-25Execute Powershell Command-0002Powershell is present.ProNoc
3:40:26 am 9-Oct-25Install - Ninja AgentOS is 1ProNoc
3:40:26 am 9-Oct-25Install - Ninja AgentInformational: Get Variable task in THEN step 4 was ignored because the client machine is running Win11, which does not meet the Mac OS X OS type criteria. (Line 13)ProNoc
3:40:26 am 9-Oct-25Install - Ninja AgentInformational: Get Variable task in THEN step 2 was ignored because the client machine is running Win11, which does not meet the Mac OS X OS type criteria. (Line 10)ProNoc
3:40:19 am 9-Oct-25Run Now - Install - Ninja AgentAdmin ProNoc scheduled procedure Run Now - Install - Ninja Agent to run at Oct 9 2025 3:40AMProNoc

Log

Script Logs