Tags

Description

Tags are a method to expose, categorise, or as the term indicates, tag jobs.

How to use them

Setting a job Tag is easy, and a job can contain multiple tags.
During job creation, simply specifying the parameter -Tags “VIP” will set the job with a tag of VIP.
Additionally, you could set multiple tags with -Tags “VIP, Human Resources”, which will add 2 Tags.  #VIP and #Human Resources

Usage examples

You can use Tags fir a variety of reasons.  They are powerful for grouping Jobs, Users, Pilot tasks, etc.
For example.  If I have created Jobs with a Tag of VIP, I can request all of those jobs in a simple cmdlet.

Get-SmJob -Tags "VIP"

This will return all jobs that contain the VIP Tag.  I can then filter further if jobs have multiple tags.
You can retrospectively set Tags to a job, or group of jobs as well.

Set-SmJob -JobId 3 -Tags "Old Migrations, Legal Team"

the above cmdlet sets two (2) tags on JobId 3.
To set a Tag on multiple jobs, you can pipe a Get-SmJob to a Set-SmJob as follows;

Get-SmJob -BatchId 3 -JobStatuses CompleteWithErrors | Set-SmJob -Tags "Investigate"

The above cmdlet will get all Jobs in BatchId 3, where issues have been encountered with some items. Those jobs are then tagged with an Investigate Tag to help you identify them quickly and easily.