Reporting Tags

Feature: PowerCLI 5.8 r1 – Filtering by Tags

Screenshot 2014-11-19 10.31.56

What are tags?

For those of you just starting with tags, tags are a relatively new function to allow users to add metadata to objects allowing those objects to be categorized. This means that by adding tags, objects in your virtual environment can be more sortable/searchable.

What would I use tags for?

I’ve seen tags used for things such as classifying the Operating System running on VM’s, specifying who is responsible for each VM, Tier of Storage, adding the Line of Business, specifying time windows for reboots and backups, policies, business critical applications, etc. The list goes on and on. The ability is there to allow flexibility on the users side to leverage these capabilities to make their jobs easier.

Previous to 5.8 we had implemented ‘filtering by tags’ in the following get-cmdlets:

  • Get-Datastore
  • Get-VDPortgroup
  • Get-VDSwitch
  • Get-VirtualPortGroup
  • Get-VM
  • Get-VMHost

As an example, If I had tagged all of the virtual machines I took care of in an environment, I could quickly see my list of machines by using the –Tag parameter on the Get-VM cmdlet.

Screenshot 2014-11-19 15.45.04

You can see how this can become beneficial to be able to filter a get- command by a tag.

Well that’s great, but what’s new in 5.8r1?

Glad you asked! One of the great features of the latest PowerCLI version is that we have expanded the objects that can use the filtering by tag parameter.

In addition to the previous get- cmdlets with the ‘filter by tag’ capability, we’ve added this funcionality now to the following cmdlets as well:

  • Get-Cluster
  • Get-DatastoreCluster
  • Get-Folder
  • Get-ResourcePool
  • Get-VDSwitch
  • Get-Datacenter
  • Get-VApp

This in turn will allow administrators another way to quickly sort through even more objects in their virtual infrastructure using metadata tags.

Can you show me any examples?

Of course! if we take a quick look at the tags in my test environment, ( get-tag | ft –AutoSize )  we can see I’m using three categories (“Owner, SME Contact, and Tier”). These tags have been setup so that I can know the criticality of different objects, as well as who to turn to if there is a question/problem with one of them.

Screenshot 2014-11-19 15.43.08

If we take a quick look at my clusters using the get-cluster command, we can see that there are four clusters in my environment. However, if I add my –Tag filter for ‘Gold’ or my highest priority clusters, my two VSAN clusters are the only objects returned.

Screenshot 2014-11-19 15.40.11

Same thing goes with my datacenters. I cannot tell which of my datacenters are being used for dev/test by their names when running the get-datacenter command. However, by adding the –Tag parameter I am able to filter my results down to see just that.

Screenshot 2014-11-19 15.40.40


If you are now sold on using tags but haven’t started implementing them in your environment yet, I would suggest you take a few minutes and read Alan Renouf’s post “Using vSphere Tags with PowerCLI which should help get you up and running quickly.




One comment has been added so far

Leave a Reply

Your email address will not be published. Required fields are marked *