Topic
This article explains how to use Remove-NinjaTag to remove a specified system tag from a device.
Environment
- NinjaOne
- Microsoft PowerShell
Description
The Remove-NinjaTag cmdlet removes one or more specified system tags from the current device. System tags are predefined tags in the NinjaOne platform that can be used to categorize and manage devices. The cmdlet removes the specified tag(s) from the current device without affecting any other assigned tags.
This cmdlet must be executed within a Ninja automation script to modify the assigned system tags. Tag assignment changes are applied after the next successful sync with the NinjaOne platform, which typically occurs within a few minutes.
Syntax
Remove-NinjaTag [-Name] <String[]> [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]
Examples
Example 1: Remove from Automation Script
PS C:> Remove-NinjaTag -Name "IIS"The specified system tag "IIS" is removed from the device.
Example 2: Remove from Active Terminal
PS C:> Remove-NinjaTag -Name "IIS"
Remove-NinjaTag : Access to tags is possible only from automation script
At line:1 char:1
+ Remove-NinjaTag -Name "IIS"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : FromStdErr: (:) [Write-Error],
WriteErrorException
+ FullyQualifiedErrorId :
Microsoft.PowerShell.Commands.WriteErrorException,Remove-NinjaTagTags are only removable from an automation script, so an error message is returned when attempting to run the cmdlet in an active terminal session.
Parameters
-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-Force
If confirm is not specified and the cmdlet would prompt for confirmation, this parameter forces the cmdlet to run without asking for confirmation.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False-Name
The name of the system tag(s) to remove from the device. This parameter accepts an array of strings, allowing you to specify multiple tags to remove in a single command.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByValue)
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: -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[]
An array of strings representing the names of the system tags to remove from the device. This input can be provided through the pipeline or as a parameter.
Outputs
None
- This cmdlet must be executed within a Ninja automation script to modify the tags of a
device. - Tag assignment changes are applied after the next successful sync with the NinjaOne
platform, which typically occurs within a few minutes.
Additional Resources
For more information about asset management and custom scripting, refer to the following resources:
- NinjaOne: Index of PowerShell Commands and Articles
- Getting Started with NinjaOne Device Tags
- Use API and CLI with NinjaOne Device Tags
- Command Line Interface (CLI)
- Assigning Devices as Documentation Delegates
- Reading from or Writing to Documentation: Automation, CLI, and API
- Command Line Interface (CLI): Supported Fields and Functionality
- NinjaOne Custom Fields: Getting Started