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

NinjaOne IT Asset Management: Create an Unmanaged Device via Command Line Interface (CLI)

Topic

This article explains how to create an unmanaged device in NinjaOne by using command-line interface (CLI) tools. 

Environment

NinjaOne IT Asset Management (ITAM)

Description

When creating unmanaged devices via CLI, you can detect items such as monitors, USB printers, and other peripherals, and define the relationship these items have with managed devices in NinjaOne. Additionally, you can assign the unmanaged device to a user via CLI, and NinjaOne will populate the data in the console where applicable.

When you install the NinjaOne RMM agent on the device, NinjaOne sends the system and BIOS serial numbers to the initial payload to optimize data mapping.

Index

Select a category to learn more:

New Command Line Options

We created new command lines and added options to existing command lines to facilitate this process. 

Command Line nameDescription
unmanaged-newCreate an unmanaged device and pass in a JSON object to define it. When you create an unmanaged device via the CLI, the device will be automatically assigned to the same organization and location as its related managed device.
unmanaged-getObtain the values of unmanaged devices related to the managed device, including ID numbers for each asset (excluding secure fields). The unmanaged device must belong to the same organization and location as its related managed device.
unmanaged-setUpdate values for existing unmanaged devices using the device ID. This command line only works if the unmanaged device is related to an existing managed device and belongs to the same organization and location.
user-setSet the currently assigned user of the device. You can use an email address as the parameter, and NinjaOne will search end users, technicians, and contacts. If an account or contact is limited to an organization, NinjaOne will only match devices that belong to the same organization as the user. Technicians must have permission to access the device. 

The following table lists the fields you can use with the unmanaged-new command line to define unmanaged devices.

Field nameRequired (Yes/No)TypeNotes
RoleYesString 
NameYesString 
RelationYesStringThe directional asset relation name between the creating and created device.
Warranty Start DateNoStringAccepts dates in YYYY-MM-DD format.
Warranty End DateNoStringAccepts dates in YYYY-MM-DD format.
Assign to Device UserNoBooleanThis option is "false" by default.
Asset IDNoString 
Asset StatusNoString 
Purchase DateNoStringAccepts dates in YYYY-MM-DD format.
Purchase AmountNoFloat 
Expected LifetimeNoStringAccepts 1, 2, 3, 4, or 5 years.
End of Life DateNoStringAccepts dates in YYYY-MM-DD format.
Asset Serial NumberNoString 
Custom Field ValuesNoMultipleAs defined when created.

For example:

.ninjarmm-clie.exe unmanaged-new '{ "assignToDeviceUser":true, "assetId": "asset-001", 
"assetSerialNumber": "asset-serial-001", "assetStatus": "in use", "customFieldValues": 
{"exampleCustomFieldName": "Custom Field Value", "typeipaddress": "255.255.255.255"},
"endOfLifeDate": "2025-12-31", "expectedLifetime": "5 years", "name": "Test Device with 
CF", "purchaseAmount": 1000, "purchaseDate": "2020-01-01", "relation": "related to", 
"role": "Another Role", "warrantyEndDate": "2023-12-31", "warrantyStartDate": "2021-01-01"}'

Using PowerShell Commands

NinjaOne supports PowerShell commands for the following:

  • New-NinjaUnmanagedDevice
  • Get-NinjaUnmanagedDevice
  • Set-NinjaUnmanagedDevice
  • Set-NinjaUser

For example: 

$DiscoveredMonitor = @{
   role               = "Monitor"
   name               = "AEG-12345 on Lukes Desktop"
   relation           = "Connected To"
   assignToDeviceUser = $true
   assetId            = "123456"
   assetSerialNumber  = "123456"
   customFieldHashMap = @{
       monitorResolution   = "1920 x 1080"
       monitorManufacturer = "AEG"
       monitorModel        = "12345"
   }
}
$Null = New-NinjaUnmanagedDevice $DiscoveredMonitor
$Devices = Get-NinjaUnmanagedDevice -Role 'Monitor' -Relation 'Connected To'
$UpdateDevice = $Devices[0]
$UpdateDevice.monitorResolution = '5120 x 1440'
$Null = Set-NinjaUnmanagedDevice $UpdateDevice

Additional Resources

Refer to NinjaOne IT Asset Management: Resource Catalog to view all related articles. 

FAQ

Next Steps