New-TagAssignment

This cmdlet assigns the specified tag to the specified entity.

Syntax

[-Entity]  <VIObjectCore[]>
-Tag  <Tag[]>
[-Server  <VIServer[]>]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
required
Entity
VIObjectCore[] 1
  • wildcards
  • pipeline
  • Specifies the object on which to assign the specified tag.
    required
    Tag
    Tag[] named
  • wildcards
  • Specifies the tag to be assigned to the entity.
    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.

    Output

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

    Examples


    Example 1

    $myTag = Get-Tag "MyTag"
    Get-VM "*MyVM*" | New-TagAssignment -Tag $myTag

    Assigns the "MyTag" tag to all virtual machines whose name contains the " MyVM " wildcard pattern.

    Related Commands

    Feedback

    Was this page helpful?