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.