CmdID

CmdID / PowerShell / Cmdlets / Write

Write-Information

Specifies how PowerShell handles information stream data for a command. PowerShell reference

From the PowerShell reference 2 parameters

Opens CmdID with your command, read as PowerShell. It is read in your browser and sent nowhere.

What it does

from the PowerShell reference, CC BY 4.0

Specifies how PowerShell handles information stream data for a command. The Write-Information cmdlet specifies how PowerShell handles information stream data for a command. Windows PowerShell 5.0 introduces a new, structured information stream. You can use this stream to transmit structured data between a script and its callers or the host application. Write-Information lets you add an informational message to the stream, and specify how PowerShell handles information stream data for a command. Information streams also work for PowerShell.Streams, jobs, and scheduled tasks. NOTE: The information stream does not follow the standard convention of prefixing its messages with "[Stream Name]:". This was intended for brevity and visual cleanliness. 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. For more information, see about_Preference_Variables and about_CommonParameters. NOTE: Starting in Windows PowerShell 5.0, Write-Host is a wrapper for Write-Information This allows you to use Write-Host to emit output to the information stream. This enables the capture or suppression of data written using Write-Host while preserving backwards compatibility. For more information see Write-Host Write-Information is also a supported workflow activity in Windows PowerShell 5.1.

Write-Information [-MessageData] <Object> [[-Tags] <String[]>] [<CommonParameters>]

Write information for Get- results

Write-Information -MessageData "Processes starting with 'P'" -InformationAction Continue Get-Process -Name p*Identify

Write information and tag it

$message = "To filter your results for PowerShell, pipe your results to the Where-Object cmdlet." Get-Process -Name p* Write-Information -MessageData $message -Tags "Instructions" -InformationAction ContinueIdentify

Write information to a file

function Test-Info { Get-Process P* Write-Information "Here you go" } Test-Info 6> Info.txtIdentify

Saving information records to a variable

Get-Process -Id $PID | Select-Object ProcessName, CPU, Path | Write-Information -Tags 'PowerShell' -InformationVariable 'InfoMsg' $InfoMsg | Select-Object *Identify

Its page in the reference: Write-Information.

Parameters

2 in the PowerShell reference
-MessageDataSpecifies an informational message that you want to display to users as they run a script or command. For best results, enclose the informational message in quotation marks.
-TagsSpecifies a simple string that you can use to sort and filter messages that you have added to the information stream with Write-Information. This parameter works similarly to the Tags parameter in New-ModuleManifest.