Write-Information
Use Write-Information to write a tagged message to the information stream, which can be captured separately from output.
Documentation: Microsoft Learn — Write-Information
Syntax
See the command anatomy
Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.
Write-Information [-MessageData] <Object> [[-Tags] <string[]>] [<CommonParameters>]- Stage 1Write-Information
-MessageData -Tags
Try it
PowerShell example · browser support is limited.
Execution scope: The full example below requires PowerShell outside this browser. You can edit this runner to use the supported practice commands; unsupported syntax returns an explanation.
Follow the objects
Run the command to inspect each stage.
Examples
Write-Information -InformationAction Continue
Show reference output
Sample output · fictional data, shaped like the real thing
Starting run
Write-Information -Tags 'progress'
Show reference output
Sample output · fictional data, shaped like the real thing
Batch 1 done
Write-Information -InformationAction Continue (2)
Show reference output
Sample output · fictional data, shaped like the real thing
Stage Rows ----- ---- Collect 42
Parameters
Parameter definitions:
-MessageData-Tags
Practical use and troubleshooting
Practical scenario: Use Write-Information when you need to write a tagged message to the information stream, which can be captured separately from output. Start with one identified target and inspect the returned values before extending the operation to a list. Keep the identity in your report so you can trace each result back to the object or path that produced it.
Common error and fix: A missing information message may reflect InformationPreference. Use -InformationAction Continue when displaying it is intended, rather than moving the message into the success stream. In an unattended script, capture this failure with its original error record and record which target failed. An empty result and an unsuccessful query must remain distinguishable in the final report.
See also: Write-Output. Write-Output sends values to the success stream; Write-Information sends an informational message to a separate stream. Function return data should not be mixed with progress narration. Read the linked command before substituting it; similar names do not imply identical inputs or output.
Recap
Write-Information Use Write-Information to write a tagged message to the information stream, which can be captured separately from output.
Next: Write-Output