Skip to main content

Asset Tags

Generated Cmdlet Help

This page has been generated from the NinjaOne PowerShell module source. To make changes please edit the appropriate PowerShell source file.

SYNOPSIS

Batch update tags for assets.

SYNTAX

Set-NinjaOneTagBatch [-assetType] <String> [-tagUpdate] <Object> [-ProgressAction <ActionPreference>] [-WhatIf]
[-Confirm] [<CommonParameters>]

DESCRIPTION

Updates tags for multiple assets of the specified asset type via the NinjaOne v2 API. Tags will be added and removed as specified for the supplied asset IDs.

EXAMPLES

EXAMPLE 1

 $tagPayload = @{
assetIds = @(123, 456)
tagIdsToAdd = @(1, 2)
tagIdsToRemove = @(3, 4)
}
PS> Set-NinjaOneTagBatch -assetType 'device' -tagUpdate $tagPayload

Adds tags 1 and 2 to devices 123 and 456, and removes tags 3 and 4 from them.

EXAMPLE 2

# FULL REQUEST EXAMPLE (AUTO-GENERATED) - BEGIN
PS> $body = @{
assetIds = @(
0
)
tagIdsToAdd = @(
0
)
tagIdsToRemove = @(
0
)
}
PS> Set-NinjaOneTagBatch -assetType string -tagUpdate $body
# FULL REQUEST EXAMPLE (AUTO-GENERATED) - END

Full request example (auto-generated).

PARAMETERS

-assetType

The asset type the tags apply to (e.g. device).

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-tagUpdate

The batch tag update payload per API schema (assetIds, tagIdsToAdd, tagIdsToRemove).

Type: Object
Parameter Sets: (All)
Aliases: body

Required: True
Position: 2
Default value: None
Accept pipeline input: True (ByPropertyName)
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

-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

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

A PowerShell object containing the batch update result.

NOTES

https://docs.homotechsual.dev/modules/ninjaone/commandlets/Set/tagbatch