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

PowerShell: Set NinjaUnmanagedDevice

Topic

This article explains how to use Set-NinjaUnmanagedDevice to update the attributes of a specified unmanaged device.

If you use the NinjaOne PowerShell Module outside of an automation script, you may need to adjust PowerShell's execution policy. For more information about execution policies, refer to Microsoft's documentation: about Execution Policies (external link).

Environment

  • NinjaOne
  • Microsoft PowerShell

Description

The Set-NinjaUnmanagedDevice cmdlet updates the attributes of a specified unmanaged device. You can update attributes such as asset information, purchase details, warranty dates, and custom fields. Unmanaged device changes are applied after the next successful sync with the NinjaOne platform, which typically occurs within a few minutes.

Syntax

Set-NinjaUnmanagedDevice [-AssetID <String>] [-AssetSerialNumber <String>] [-AssetStatus <String>] [-EndOfLifeDate <DateTime>] [-ExpectedLifetime <String>] [[-ID] <Int32>] [- Name <String>] [-PurchaseAmount <Decimal>] [-PurchaseDate <DateTime>] [-WarrantyStartDate <DateTime>] [-WarrantyEndDate <DateTime>] [-CustomFieldHashtable <Hashtable>] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]

Examples

Example 1: Modify Using Individual Properties

PS C:> Set-NinjaUnmanagedDevice -Id 1314 -PurchaseAmount 100.00

The purchase amount for the unmanaged device with ID 1314 is updated to $100.00.

Example 2: Modify Using Input Object

$LukesMonitor = @{
id = 1314
assetId = "8675309"
assetSerialNumber = "9565035"
assetStatus = "In use"
endOfLifeDate = "2027-02-21"
expectedLifetime = "1 year"
name = "AEG-12345 on Lukes Desktop"
purchaseAmount = 100.00
purchaseDate = "2026-02-21"
warrantyEndDate = "2027-02-21"
warrantyStartDate = "2026-02-21"
customFieldValues = @{
exampleTextField = "My Text Field Value"
}
}
PS C:> $LukesMonitor | Set-NinjaUnmanagedDevice

The attributes of the unmanaged device with ID 1314 are updated based on the values provided in the input object.

Parameters

-AssetID

Specify an identication number to associate with the device. This is not the same as the device ID in NinjaOne, but can be used to track asset information.

Type: String
Parameter Sets: IndividualProperties
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-AssetSerialNumber

Specify the serial number of the device to associate with the device.

Type: String
Parameter Sets: IndividualProperties
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-AssetStatus

Specify the current status of the asset. Valid values include "Procurement," "Provisioning," "Inventory," "In use," "Maintenance," "Retired," and "Archived."

Type: String
Parameter Sets: IndividualProperties
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-CustomFieldHashtable

Set the custom fields of the device by utilizing a hash table. Use the custom field name as the key and its corresponding value as the value.

Type: Hashtable
Parameter Sets: IndividualProperties
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-EndOfLifeDate

Specify the date when the asset should be considered 'end of life' using a datetime object.

Type: DateTime
Parameter Sets: IndividualProperties
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ExpectedLifetime

Enter the expected lifetime of the device. Please note that only "1 year", "2 years", "3 years", "4 years", and "5 years" are valid values.

Type: String
Parameter Sets: IndividualProperties
Aliases:
Accepted values: 1 year, 2 years, 3 years, 4 years, 5 years
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Force

If the Confirm parameter is not specified, the Force parameter will override ShouldProcess and allow the cmdlet to continue processing.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ID

Specify the NinjaOne Device ID of the unmanaged device to update. You can retrieve the device ID using the Get-NinjaUnmanagedDevice cmdlet.

Type: Int32
Parameter Sets: IndividualProperties
Aliases:
Required: False
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-InputObject

Specify an object to process instead of using individual parameters. The object must contain a property for the device ID and can optionally include properties for any of the other attributes that can be updated.

Type: PSObject
Parameter Sets: Pipeline
Aliases:
Required: False
Position: 0
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
-Name

Enter the name of the unmanaged device you wish to create.

Type: String
Parameter Sets: IndividualProperties
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-PurchaseAmount

Save the amount of money spent on purchasing the device.

Type: Decimal
Parameter Sets: IndividualProperties
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-PurchaseDate

Specify the date when the device was purchased using a datetime object.

Type: DateTime
Parameter Sets: IndividualProperties
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-WarrantyEndDate

Specify the end date of the device's warranty using a datetime object.

Type: DateTime
Parameter Sets: IndividualProperties
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-WarrantyStartDate

Specify the start date of the device's warranty using a datetime object.

Type: DateTime
Parameter Sets: IndividualProperties
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

Common Parameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information about common parameters, refer to Microsoft document about_CommonParameters (external link).

Inputs

System.Object

The InputObject parameter accepts a PSObject that contains the properties of the unmanaged device to update. The object must include a property for the device ID and can optionally include properties for any of the other attributes that can be updated.

System.String

Most parameters of this cmdlet accept string input when not using the InputObject parameter, such as Name , Role , and Relation .

System.DateTime

Parameters such as PurchaseDate , WarrantyStartDate , and WarrantyEndDate accept DateTime input when not using the InputObject parameter.

System.Decimal

The PurchaseAmount parameter accepts decimal input when not using the InputObject parameter.

System.Hashtable

The CustomFieldHashtable parameter accepts a hashtable input when not using the InputObject parameter.

Outputs

System.Object

NinjaOne will display the new unmanaged device upon a successful sync, which usually occurs within a few minutes.

Additional Resources

For more information about asset management and custom scripting, refer to the following resources:

FAQ

Next Steps