Write-Information results in InformationRecord being added to the Information stream unexpectedly in some cases
See original GitHub issueSteps to reproduce
First run this in a new PowerShell session with -noprofile:
Write-Information 'Information'
Write-Verbose 'Verbose'
Write-Debug 'Debug'
Note how none of those produce any output, because each of their corresponding $*Preference variables is set to [System.Management.Automation.ActionPreference]::SilentlyContinue by default.
Now run this in the same session:
$ps = [powershell]::Create()
$ps.AddScript(@'
Write-Information 'Information'
Write-Verbose 'Verbose'
Write-Debug 'Debug'
'@).Invoke()
$ps.Streams.Verbose # Empty, as expected
$ps.Streams.Debug # Empty, as expected
$ps.Streams.Information # Not empty, and outputs "Information"...why?
Expected behavior
Both blocks of code would not output anything.
Actual behavior
The second block outputs the following text:
Information
Environment data
Name Value
---- -----
PSVersion 7.0.3
PSEdition Core
GitCommitId 7.0.3
OS Microsoft Windows 10.0.18363
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:7 (4 by maintainers)
Top Results From Across the Web
How to process Write-Information pipeline output when ...
Unlike SilentlyContinue , Ignore completely forgets the informational message; it doesn't add the informational message to the information ...
Read more >Write-Information (Microsoft.PowerShell.Utility)
Write-Information lets you add an informational message to the stream, and specify how PowerShell handles information stream data for a command.
Read more >How to run PowerShell Core scripts from .NET Core applications
In this article we will jump forward to take a look at runspace execution for PowerShell Core and .NET Core applications. Including topics...
Read more >Write-Information - PowerShell Command - PDQ
Write-Information lets you add an informational message to the stream, and specify how Windows PowerShell handles information stream data for a command. The...
Read more >Remedy & ITSM Error Message Lookup - ARE|RRR - rrr.se
Level Number Subject
NOTE 32 AR System server terminated normally.
ARERR 49 Internal error: The request ID is invalid.
WARNING 50 You have no permission to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@vexx32, the transcript behavior with respect to
Write-Informationhas been fixed (after all, a transcript should not show different output than the console), though I’m not sure in what version exactly, and I’m not aware of an associated bug report (still affects Windows PowerShell; see also: #4645).Let me try to summarize the troubling inconsistency (derived from observation, not source-code analysis):
Unlike with all other streams,
SilentlyContinuefor stream6(Write-Information) does not suppress writing to the stream at the source.Seemingly, it is unexpectedly left to the host to enforce the silence for display.
This is easy to demonstrate: a redirection of stream
6succeeds even with-InformationAction SilentlyContinue:To contrast this with the behavior of the
Write-*cmdlets for the other streams:I suppose, why be consistent, right? Just because the error, warning, verbose, debug and progress streams can be silenced using
System.Management.Automation.ActionPreference.SilentlyContinue, why should the information stream work the same way? That would make too much sense. 🙄