Write to the information stream data.
Syntax Write-Information [-MessageData] Object [[-Tags] String[]] [CommonParameters] Key -MessageData Object An informational message to display to users as they run a script or command. For best results, enclose the message in quotes: "Test complete." -Tags String[] A simple string that can be used to sort and filter messages that have been added to the information stream with Write-Information. This parameter works similarly to the -Tags parameter in New-ModuleManifest.
Windows PowerShell 5.0 introduces a new, structured information stream (number 6 in Windows PowerShell streams) that you can use to transmit structured data between a script and its callers (or hosting environment).
Write-Information lets you add an informational message to the stream, and specify how Windows PowerShell handles information stream data for a command.
The $InformationPreference preference variable value determines whether the message you provide to Write-Information is displayed at the expected point in a script's operation. Because the default value of this variable is SilentlyContinue, by default, informational messages are not shown.
If you don't want to change the value of $InformationPreference, you can override its value by adding the -InformationAction common parameter to your command.
Starting in PowerShell 5.0, Write-Host is a wrapper for Write-Information . You can now use Write-Host to emit output to the information stream, but the $InformationPreference preference variable and InformationAction common parameter do not affect Write-Host messages.
Information streams also work for PowerShell.Streams, jobs, scheduled jobs, and workflows.
Write-Information is also a supported workflow activity.
Examples
By default Write-Information output is not displayed because the $InformationPreference variable is set to its default, SilentlyContinue:
PS C:\> Write-Information -MessageData "This will not display"
Setting -InformationAction will over-ride the default:
PS C:\> Write-Information -MessageData "This will display" -InformationAction Continue
Adding -tags means that if you later search the information stream for messages tagged 'ss64', the message specified here would be among the results:
PS C:\> Write-Information -MessageData "Insert floppy disc" -Tags "ss64" -InformationAction Continue
"You own everything that happened to you. Tell your stories.
If people wanted you to write warmly about them, they should have behaved better" ~ Anne Lamott
Related PowerShell Cmdlets:
Tee-Object - Send input objects to two places.
Write-Debug - Write a debug message to the host display.
Write-Error - Write an object to the error pipeline.
Write-Host - Display objects through the host user interface.
Write-Output - Write an object to the pipeline.
Write-Progress - Display a progress bar.
Write-Verbose - Write a string to the host’s verbose display.
Write-Warning - Write a warning message.