## 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

Name | Type | Description | Required? | Pipeline Input | Default Value
--- | --- | --- | --- | --- | ---
Entity | VIObjectCore[] | Retrieves the tags associated with the specified items. | false | true (ByValue)
Category | TagCategory[] | Returns the tags that belong to the specified categories. | false | false
Server | VIServer[] | 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. | false | false

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.