Get-TagAssignment Command | Vmware PowerCLI Reference

Get-TagAssignment

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.

Syntax

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

Parameters

Required Parameter Name Type Position Features Description
optional Category TagCategory[] named
  • wildcards
Returns the tags that belong to the specified categories.
optional Entity VIObjectCore[] named
  • pipeline
  • wildcards
Retrieves the tags associated with the specified items.
optional ProgressAction ActionPreference named
optional Server VIServer[] named
  • wildcards
Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is provided or $null 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.
optional Tag Tag[] named
  • wildcards
Returns the tag assignments that belong to the specified tags.

Output

VMware.VimAutomation.ViCore.Types.V1.Tagging.TagAssignment

Examples

Example 1

Get-TagAssignment

Retrieves all tag assignments for the current vCenter Server instances.

Example 2

$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.

Example 3

Get-TagAssignment -Tag MyTag

Retrieves all assignments of the specified tag.

Related Commands

Tag

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

This cmdlet creates a new tag in the specified tag category with the specified parameters.

This cmdlet removes the specified tags from the server.

This cmdlet modifies the specified tags.

TagAssignment

This cmdlet retrieves the tag assignments of objects.

This cmdlet assigns the specified tag(s) to the specified entity(s).

This cmdlet removes the specified tag assignment.

TagCategory

This cmdlet retrieves the tag categories available on a vCenter Server system and filters them using the specified cmdlet parameters.

This cmdlet creates a new tag category on the specified vCenter Server systems with the specified parameters.

This cmdlet removes the specified tag categories from the server.

This cmdlet modifies the specified tag categories.