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

PowerShell: Options-NinjaTag

Topic

This article explains how to use Options-NinjaTag to list all possible system tags for a 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 Options-NinjaTag cmdlet retrieves a list of all possible system tags that can be
assigned to a device. This cmdlet must be executed within a Ninja automation script to access the tag information.

Syntax

Options-NinjaTag [<CommonParameters>]

Examples

Example 1: Retrieve from Automation Script

PS C:> Options-NinjaTag
IIS
Stuff
Fax Server
Data Deduplication
File Server
ADDS
DNS
ESU Eligible
DFS Replication

All possible system tags for a device are listed in the output. The actual tags assigned to the device can be retrieved using the Get-NinjaTag cmdlet.

Example 2: Retrieve from Active Terminal

PS C:> Options-NinjaTag
Options-NinjaTag : Access to tags is possible only from automation script
At line:1 char:1
+ Options-NinjaTag
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : FromStdErr: (:) [Write-Error],
WriteErrorException
+ FullyQualifiedErrorId :
Microsoft.PowerShell.Commands.WriteErrorException,Options-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

Title

text

Title

text

Common 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

None

Outputs

System.String[]

When executed, this cmdlet returns an array of strings representing all possible system tags that can be assigned to a device.

This cmdlet must be executed within a Ninja automation script to access the tag information.

Additional Resources

For more information about asset management and custom scripting, refer to the following resources:

FAQ

Next Steps