One of my team members recently asked about the differences between Write-Host and Out-Host in PowerShell. As a PowerShell developer, you should know when to use which cmdlet. In this tutorial, I will explain everything about PowerShell Write-Host vs Out-Host with examples.
What is Write-Host in PowerShell?
Write-Host is a cmdlet in PowerShell used to display text directly to the console. It is typically used to display messages that do not need to be processed further in the pipeline.
Syntax
Here is the syntax:
Write-Host [-Object] <Object> [-NoNewline] [-Separator <Object>] [-ForegroundColor <ConsoleColor>] [-BackgroundColor <ConsoleColor>] [<CommonParameters>]The primary purpose of Write-Host is to produce output for display only. This means it does not send output to the pipeline, which can be useful when you want to display information to the user without interfering with the data flow of your script.
Examples
Here is an example to help you understand it better.
# Display a simple message
Write-Host "Processing data for John Doe..."
# Display a message with colors
Write-Host "Error: Invalid input detected" -ForegroundColor Red -BackgroundColor Yellow
# Display multiple items with a separator
Write-Host "Alice" "Bob" "Charlie" -Separator ", "In these examples, Write-Host is used to provide immediate feedback to the user. For instance, the first example informs the user that data for “John Doe” is being processed, while the second example highlights an error message in red text on a yellow background.
Here is the exact output in the screenshot below:

Check out PowerShell Write-Host vs Write-Verbose
What is Out-Host in PowerShell?
Out-Host is another cmdlet in PowerShell that sends output to the PowerShell host for display. Unlike Write-Host, Out-Host sends objects down the pipeline, allowing for further processing or display at the command line.
Syntax
Here is the syntax of Out-Host in PowerShell.
Out-Host [-Paging] [<CommonParameters>]Out-Host is used to control how output is displayed in the console. It can be particularly useful when dealing with large amounts of data that need to be paginated or when you want to ensure that the output remains in the pipeline for further processing.
Examples
Here is an example.
# Send output to the host
Get-Process | Out-Host
# Paginate output
Get-Process | Out-Host -PagingIn these examples, Out-Host is used to display the list of running processes. The -Paging parameter is particularly useful when dealing with a large list, as it lets you view the output one page at a time.
Check out PowerShell Write-Host vs Write-Error
Key Differences Between Write-Host and Out-Host
Here is the summary of the differences between Write-Host and Out-Host, I’ve created the following table:
| Feature | Write-Host | Out-Host |
|---|---|---|
| Output Type | Display-only | Sends output to the pipeline |
| Use Case | Displaying messages, debugging | Displaying and paginating output |
| Syntax | Write-Host "message" | Get-Process | Out-Host |
| Color Support | Yes (ForegroundColor, BackgroundColor) | No |
| Pipeline Interaction | No | Yes |
Conclusion
I explained the differences between Write-Host and Out-Host in PowerShell scripting in this tutorial. Write-Host is ideal for displaying messages directly to the console without affecting the pipeline. On the other hand, Out-Host is useful for sending output to the console while keeping it in the pipeline. If you still have any questions, feel free to comment below.
You may also like the following tutorials:
- PowerShell Write-Host vs Write-Information
- PowerShell Write-Host vs Echo
- PowerShell Write-Host vs Write-Output
Bijay Kumar is an esteemed author and the mind behind PowerShellFAQs.com, where he shares his extensive knowledge and expertise in PowerShell, with a particular focus on SharePoint projects. Recognized for his contributions to the tech community, Bijay has been honored with the prestigious Microsoft MVP award. With over 15 years of experience in the software industry, he has a rich professional background, having worked with industry giants such as HP and TCS. His insights and guidance have made him a respected figure in the world of software development and administration. Read more.