Already a NinjaOne customer? Log in to view more guides and the latest updates.

Command Line Interface (CLI) Supported Fields and Functionality

Topic

This documentation describes the ninjarmm-cli component for Windows, Mac, and Linux devices.

Environment

  • NinjaOne Endpoint Management
  • NinjaOne Documentation
  • Microsoft Windows 
  • macOS
  • Linux

Description

This file is an executable that you can use to access and interact with particular custom fields and NinjaOne Documentation data from the command line interface (CLI), or Terminal, or custom scripts. Refer to Using Command Line Interface (CLI) in NinjaOne and Getting Started with NinjaOne's Automation Library (Scripting).

Select a category to learn more: 

About CLI-Supported Fields

Keep these considerations in mind when using CLI-supported fields:

  • Use CLI to set the device's asset ID to any supported value. 
  • Secure fields are write-only for NinjaOne Documentation fields. 
  • The system can read documentation data from or write Documentation data to the CLI or custom scripts. You may get a list of templates, a list of documents by template name or ID, and the value of each field in a document.
    • Only templates or documents with at least one filled field are accessible via the CLI or custom scripts. The system does not display empty templates or documents.
  • You can use custom scripts written in either Batch or PowerShell for Windows, or in ShellScript for macOS and Linux.
    • Since ninjarmm-cli.exe resides in a protected folder that is inaccessible to regular users, any script using this functionality should be run as a system (or permissions should be changed accordingly).
  • Only devices assigned as delegates can update Documentation fields via CLI or scripts. Refer to Assigning Devices as Documentation Delegates for more information. 
  • Devices read the closest value set to them based on inheritance with the workflow of: Device → end user assigned to the device → device location → device organization. 
    • If the device's inheritance outcome does not have a value, it will inherit the value from the end user. 
    • If the inheritance outcome for the end user does not have a value, it will inherit the value from the location. 
    • If the location's inheritance outcome does not have a value, it will inherit the value from the organization. 
    • If the outcome of the inheritance for the organization does not have value, the field will remain empty.

Custom Fields and Documentation Supported Fields

The following table outlines which fields support access via CLI and custom scripts.

FieldRead AccessWrite Access
AttachmentX
Checkbox
Date
Date and Time
Decimal
Device drop-downX
Device multi-selectX
Drop-down
Email
Integer
IP Address
Multi-line
Multi-select
Organization drop-downX
Organization Location drop-downX
Organization Location multi-selectX
Organization multi-selectX
Phone
Secure*
Text
Time
WYSIWYG
URL 

Additional Supported Functionality

The following information discusses computed fields and advanced settings.

Computed Fields

The CLI tool supports computed fields, letting you display values automatically generated from other data. For example, you can do something like this:

> ninjarmm-cli.exe set firstfield myvalue
myvalue
> ninjarmm-cli.exe get firstfield
myvalue
> ninjarmm-cli.exe get secondfield
othervalue
> ninjarmm-cli.exe set secondfield __firstfield__
myvalue
> ninjarmm-cli.exe get secondfield
myvalue
In the above example, we set the value of the firstfield to the secondfield by using special symbols __ firstfield__ in the set operation.

Advanced Settings

The CLI utility can handle advanced settings, which may be defined when configuring the different fields. For example, you can define ranges for integers, decimals, dates, dates and times, and times. 

Additional Resources

Refer to the following resources to learn more about custom fields and automation in NinjaOne:

 

FAQ

Next Steps