PowerCLI Reference

Get-TagAssignment

Synopsis

This cmdlet retrieves the tag assignments of objects.

Syntax

Get-TagAssignment [[-Entity] <VIObjectCore[]>] [-Category <TagCategory[]>] [-Server <VIServer[]>] [<CommonParameters>]

Related Commands

Online version
Get-Tag
New-TagAssignment
Remove-TagAssignment

Detailed Description

This cmdlet retrieves the tag assignments of objects. If the Entity parameter is specified, the cmdlet returns only the tag assignments for the corresponding items. If the Category parameter is specified, the cmdlet returns only the tag assignments of tags that belong to the specified category.

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
EntityVIObjectCore[]Retrieves the tags associated with the specified items.falsetrue (ByValue)
CategoryTagCategory[]Returns the tags that belong to the specified categories.falsefalse
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 TagAssignment objects

Notes

Works only with vCenter Server 5.1 or later.

Examples

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

$datastore = Get-DataStore MyDatastore
Get-TagAssignment -Entity $datastore -Category MyCategory

Retrieves all tag assignments for the $datastore entity that have tags from the "MyCategory" category.


Copyright © VMware, Inc. All rights reserved.