You can retrieve existing tags defined in vSphere and save a specific tag into a variable.

Prerequisites

Verify that you are connected to a vCenter Server system.

Procedure

  1. Get the tag named MyTag.
    Get-Tag -Name 'MyTag'
  2. Save the tag into a variable.
    $tag = Get-Tag -Name 'MyTag'