liveBook · Manning

Resource tag

As explained in Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools

A tag is a label attached to an informational message or software artifact for classification and filtering.

A tag is a label attached to an informational message or software artifact for classification and filtering. In PowerShell, tags organize Information stream records; in a module manifest, they help describe and discover a project. section 13.4 section 22.4.2

Use tags to make automation output easier to manage:

  • Label messages by role, such as Process, Meta, Data, status, or notice. section 13.4
  • Capture messages in an information variable and filter records through their Tags property. section 13.4
  • Add searchable keywords to a published module's manifest metadata. section 22.4.2

Filter tagged information

Write-Information "Starting" -Tag Process; Write-Information "No parameters" -Tag Notice; then filter captured records with $x | Where Tags -in @('Notice'). section 13.4

Function Example {
    [CmdletBinding()]
    Param()
    Write-Information "First message" -tag status
    Write-Information "Note that this had no parameters" -tag notice
    Write-Information "Second message" -tag status
}
Example -InformationAction Continue -InformationVariable x

Shows a function that emits status and notice messages, captures them, and enables informational output. section 13.4

How Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools covers it

How deep it goes
Demonstrates tag assignment, capture, object inspection, filtering, and manifest entry without developing a tagging taxonomy.
Examples
Uses Process, Meta, Data, status, and notice labels on captured PowerShell information records.
What it assumes
Assumes PowerShell function and command familiarity while demonstrating tag use through concrete commands.
What you can do after
Apply it via Write-Information and module manifests to organize output or improve project discoverability.
How it connects
Connects tags with the Information stream, Write-Information, information variables, filtering, and module manifests.

Also explained in

Compare how 6 books explain resource tag →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools. The section links point to the parts of the book it draws on.