Topic
This article explains how to use Get-NinjaTagto retrieve the system tags currently assigned to a device.
Environment
- NinjaOne
- Microsoft PowerShell
Description
The Get-NinjaTag cmdlet retrieves the system tags assigned to the current device.
Syntax
Get-NinjaTag [CommonParameters]
Examples
Example 1: Retrieve from Automation Script
PS C:> Get-NinjaTag
Data Deduplication
Active Directory Domain Services
❤️The system tags currently assigned to the device are listed in the output. The full list of possible system tags can be retrieved using the Options-NinjaTag cmdlet.
Example 2: Retrieve from Active Terminal
PS C:> Get-NinjaTag
Get-NinjaTag : Access to tags is possible only from automation script
At line:1 char:1
+ Get-NinjaTag
+ ~~~~~~~~~~~~
+ CategoryInfo : FromStdErr: (:) [Write-Error],
WriteErrorException
Get-NinjaTag
+ FullyQualifiedErrorId :
Microsoft.PowerShell.Commands.WriteErrorException,Get-NinjaTag
Tags are only retrievable from an automation script, so an error message is returned when attempting to run the cmdlet in an active terminal session.
Parameters
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -
InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -
Verbose, -WarningAction, and -WarningVariable. For more information, refer to Microsoft document
about_CommonParameters (external link).
INPUTS
None
OUTPUTS
System.String[]This cmdlet will return a string value or an array of strings, depending on the number of tags assigned.
Additional Resources
Refer to the following articles for more information on
- NinjaOne Endpoint Management: Index of PowerShell Commands and Articles
- Getting Started with NinjaOne Device Tags
- Use API and CLI with NinjaOne Device Tags