Retrieve Objects by Tag

You can retrieve all objects that have a specific tag assigned to them.

Prerequisites

Verify that you are connected to a vCenter Server system.

Procedure

  • Get all virtual machines tagged with the salesDptTag tag.
    Get-VM -Tag 'salesDptTag'
    Note: You can only specify a tag filter parameter for the VM, VMHost, Datastore, and VirtualPortGroup object types.