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

PowerShell: Get-NinjaUnmanagedDevice

Topic

This article explains how to use Get-NinjaUnmanagedDevice to retrieve unmanaged devices associated with the current 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 Get-NinjaUnmanagedDevice cmdlet retrieves a list of unmanaged devices associated
with the current device. You can refine the results by specifying filters such as name, role, relation, or ID. The cmdlet returns detailed information about each unmanaged device, excluding secure fields.

Unmanaged devices must belong to the same organization and location as
their related managed device.

Syntax

Get-NinjaUnmanagedDevice [[-Name]] [-Role] [-Relation] []

Examples

Example 1: Retrieve All Unmanaged Devices

PS C:> Get-NinjaUnmanagedDevice
assetId : 23458
assetSerialNumber :
assetStatus :
endOfLifeDate :
expectedLifetime :
id : 1308
name : Nvidia 5070
Get-NinjaUnmanagedDevice
1 / 5
If no name, role, or relation are given, it returns all unmanaged devices with an asset relation
to the current device.
Example 2: Filter the List Using the Optional Parameters
purchaseAmount : 0
purchaseDate :
relation : Part of
role : GPU
warrantyEndDate :
warrantyStartDate :
assetId : 23457
assetSerialNumber :
assetStatus :
endOfLifeDate :
expectedLifetime :
id : 1307
name : LG Ultrawide
purchaseAmount : 0
purchaseDate :
relation : Connected to
role : Monitors
warrantyEndDate :
warrantyStartDate :

If no name, role, or relation are given, it returns all unmanaged devices with an asset relation
to the current device.

Example 2: Filter the List Using the Optional Parameters

PS C:> Get-NinjaUnmanagedDevice -Relation "Part of"
assetId : 23458
assetSerialNumber :
assetStatus :
endOfLifeDate :
expectedLifetime :
id : 1308
name : Nvidia 5070
purchaseAmount : 0
purchaseDate :
relation : Part of
role : GPU
warrantyEndDate :
warrantyStartDate :

Filter the returned devices by specifying the name, role, relation, or ID you are searching for.

Parameters

-Id
Specify the unique ID of an unmanaged device. Note that this is different from the Asset ID
and is not visible in the Web UI.
Type: Int32[]
Parameter Sets: Id
Aliases:
Required: False
Position: 0
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
-Name

Specify the exact name of the unmanaged devices you would like to retrieve.

Type: String[]
Parameter Sets: Name
Aliases:
Required: False
Position: 0
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
-Relation
Filters the retrieved list by the entity relationship of the unmanaged devices.

Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Get-NinjaUnmanagedDevice
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Role

Retrieves only unmanaged devices that match the specified unmanaged device role.

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

Common Parameters

This cmdlet supports the folloeing 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.String[]

You can pipe a string containing an unmanaged device name to this cmdlet.
System.Int32[]
You can pipe an integer containing the unmanaged device ID to this cmdlet.

Outputs

System.Object

This cmdlet outputs an object or an array of objects containing the unmanaged devices you requested.

Additional Resources

You can access these resources for more information on custom scripting and related topics:

FAQ

Next Steps