liveBook · Manning

Information stream

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

The information stream is a PowerShell output stream for informational messages intended for display or related handling.

The Information stream is PowerShell’s sixth output stream, introduced in PowerShell 5, for informational messages intended for display or related handling. Unlike ordinary pipeline output, it is designed for structured messages that can be displayed, suppressed, captured, tagged, or searched. section 13.4 section 13.6

Control informational output with these mechanisms:

  • Use Write-Information with a message and optional tags such as status, notice, process, meta, or data. section 13.4 section 13.4.1
  • Use -InformationAction Continue to display messages, or SilentlyContinue to suppress display while retaining captured records. section 13.4 section 13.4.1
  • Use -InformationVariable to collect information records without cluttering normal command output, then filter them by tags. section 13.4 section 13.4.1
  • Prefer Write-Information over Write-Host for tool messages; reserve host-oriented commands for deliberately human-interactive tools. section 18.9

Capture and filter tagged messages

A function can emit status and notice messages, run it with Example -InformationAction Continue -InformationVariable x, and later select only records whose Tags contain notice. Captured records expose MessageData, Tags, timestamps, process information, and host metadata. section 13.4 section 13.4.1

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

Use this compact function to see tagged status and notice messages, then compare visible output with captured information records. 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
Explains commands, tags, preferences, capture, and records, while stopping short of a full implementation pattern for production logging.
Examples
Demonstrates tagged messages, InformationVariable capture, InformationRecord inspection, tag filtering, and a process-reporting function.
What it assumes
Assumes intermediate PowerShell familiarity and distinguishes informational messages from success-stream objects and reusable tool output.
What you can do after
Apply it via Write-Information to emit controllable messages and capture or filter them with common parameters.
How it connects
Connects Write-Information with Write-Host, common parameters, preference variables, output streams, and structured data.

Also explained in

Compare how 2 books explain information stream →

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.