Write-Information sends structured messages to PowerShell’s Information stream. The stream is suppressed by default through $InformationPreference = SilentlyContinue, so use -InformationAction Continue when messages should appear. section 13.4
Use the cmdlet deliberately when automation needs informational output that can be displayed, captured, or filtered.
- Pass the message as the first argument through -MessageData, then add tags such as Process, Meta, or Data. section 13.4
- Enable display with -InformationAction Continue, or suppress display while collecting records with -InformationVariable. section 13.4
- Treat captured values as InformationRecord objects whose MessageData, Tags, source, time, and process properties can be inspected. section 13.4.1
- Prefer Write-Information over Write-Host when the output belongs in the Information stream; use Write-Progress for ongoing process feedback. section 18.9
Tagged messages with separate display and capture
A function can emit tagged messages such as “First message” with the status tag and “Note that this had no parameters” with the notice tag. Run it with -InformationAction SilentlyContinue -InformationVariable x to keep the console quiet, then filter $x for records whose Tags include notice.
