PowerShell difference between Write-Host and Write-Output?

In a nutshell, Write-Host writes to the console itself. Think of it as a MsgBox in VBScript. Write-Output, on the other hand, writes to the pipeline, so the next command can accept it as its input. You are not required to use Write-Output in order to write objects, as Write-Output is implicitly called for you.

PS> Get-Service

would be the same as:

PS> Get-Service | Write-Output

Leave a Comment