PowerCLI Reference

Get-Tag

Synopsis

This cmdlet retrieves the tags available on a vCenter Server system.

Syntax

Get-Tag [[-Name] <String[]>] [-Category <TagCategory[]>] [-Server <VIServer[]>] [<CommonParameters>]

Get-Tag -Id <String[]> [-Server <VIServer[]>] [<CommonParameters>]

Related Commands

Online version
New-Tag
Remove-Tag
Set-Tag

Detailed Description

This cmdlet retrieves the tags available on a vCenter Server system. This cmdlet filters tags by name and category to which tags belong.

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
NameString[]Filters the tags by name.falsefalse
CategoryTagCategory[]Filters the tags by category.falsetrue (ByValue)
IdString[]Filters the tags by ID.

Note: When a list of values is specified for the Id parameter, the returned objects would have an ID that matches exactly one of the string values in that list.
truefalse
ServerVIServer[]Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is passed to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer.falsefalse

Return Type

Zero or more Tag objects

Notes

Works only with vCenter Server 5.1 or later.

Examples

-------------- Example 1 --------------

Get-Tag -Name "MyTag"

Returns all tags named "MyTag".

-------------- Example 2 --------------

Get-Tag -Category "MyCategory1", "MyCategory2" -Name "MyTag"

Returns all tags from the "MyCategory1" and "MyCategory2" categories, named "MyTag".


Copyright © VMware, Inc. All rights reserved.