Topic
This article explains how to use New-NinjaUnmanagedDevice to create a new unmanaged device with your specified details.
Environment
- NinjaOne
- Microsoft PowerShell
Description
The New-NinjaUnmanagedDevice cmdlet creates an unmanaged device and associates it with a specified asset relationship to the current device. The new unmanaged device is automatically assigned to the same organization and location as the related managed device.
Additionally, you can provide various optional fields to customize the device during its creation, such as its warranty start and end dates or other relevant details. NinjaOne will display the new unmanaged device upon a successful sync, which usually occurs within a few minutes.
Syntax
Individual Properties (Default)
NinjaUnmanagedDevice [[-Name] <String>] [-Role <String>] [-Relation <String>] [-AssetID <String>] [-AssetSerialNumber <String>] [-AssetStatus <String>] [-EndOfLifeDate <DateTime>] [-ExpectedLifetime <String>] [-PurchaseAmount <Decimal>] [-PurchaseDate <DateTime>] [-WarrantyStartDate <DateTime>] [-WarrantyEndDate <DateTime>] [-CustomFieldHashtable <Hashtable>] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]
Pipeline
New-NinjaUnmanagedDevice [[-InputObject] <Object>] [-Force] [-WhatIf] [- Confirm] [<CommonParameters>]
Examples
Example 1: Create from Individual Properties
PS C:> New-NinjaUnmanagedDevice -Name "AEG-12345 on Lukes Desktop" -Role
"Monitors" -Relation "Connected To"The minimum amount of information required to create an unmanaged device is its name,
unmanaged device role, and entity relationship.
Example 2: Create from Input Object
$LukesMonitor = @{
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"
relation = "Connected To"
role = "Monitors"
warrantyEndDate = "2027-02-21"
warrantyStartDate = "2026-02-21"
customFieldValues = @{
exampleTextField = "My Text Field Value"
}
}
PS C:> New-NinjaUnmanagedDevice -InputObject $LukesMonitorTo specify additional information using the input object format, format your object as shown
in the example above.
Example 3: Using the Custom Field Hashtable
$MyCustomFieldValues = @{
exampleTextField = "My Text Custom Field Value"
}
PS C:> New-NinjaUnmanagedDevice -Name "AEG-12345 on Lukes Desktop" -Role
"Monitors" -Relation "Connected To" -CustomFieldHashtable
$MyCustomFieldValuesIf you want to use individual properties and specify certain custom field values, you can use
the CustomFieldHashtable parameter.
Parameters
-AssetID
Specify an identification number to associate with your new asset.
Type: String
Parameter Sets: IndividualProperties
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False-AssetSerialNumber
Stores the unmanaged devices' serial numbers.
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-ConfirmFieldHashtable
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. 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-InputObject
Specify an object to process instead of using individual parameters.
Type: Object
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: 0
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-Relation
Specify the relation of the unmanaged device to the current device.
Type: String
Parameter Sets: IndividualProperties
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False-Role
Specify the unmanaged device role of the unmanaged device.
Type: String
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: FalseCommon Parameters
This cmdlet supports the common parameters: For more information about common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.refer to Microsoft document about_CommonParameters (external link).
Inputs
System.Object
This cmdlet can accept an object as input through the pipeline or by specifying the InputObject parameter.
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
None
Additional Resources
For more information about asset management and custom scripting, refer to the following resources: