Write-Host
Use Write-Host to display coloured messages in the console — status updates, warnings, and headings that stand out from normal output.
Documentation: Microsoft Learn — write-host
Syntax
Try it
PowerShell example · browser support is limited.
Execution scope: The full example below requires PowerShell outside this browser. You can edit this runner to use the supported practice commands; unsupported syntax returns an explanation.
Examples
Write a green success message
Show reference output
Illustrative output · values vary by environment
Deployment complete
Write on one line without a newline
Show reference output
Illustrative output · values vary by environment
Processing... Done
Join several values with a separator
Show reference output
Illustrative output · values vary by environment
Server | Database | Web
Parameters
Parameter definitions:
-Object— The text or objects to display.-ForegroundColor— Text colour: Black, DarkBlue, Green, Cyan, Red, Magenta, Yellow, White, and the Dark variants.-BackgroundColor— Background colour behind the text.-NoNewline— Writes without adding a newline, so the next output continues on the same line.-Separator— Text placed between multiple objects instead of a space.
Write-Host is for humans, never for data
Write-Host output cannot be captured, piped, or redirected to a file by the caller. If another script or person needs the value, use Write-Output instead. Reserve Write-Host for status messages a human reads while the script runs.
Since Windows PowerShell 5.1, Write-Host writes to the information stream, so it can be silenced with -InformationAction SilentlyContinue and captured with 6> file.txt. That makes it safer than it used to be, but it still does not go down the pipeline.
Colour is a readability tool, not decoration. Use one consistent scheme: green for success, yellow for warnings, red for errors, cyan for headings. Random colours on every line make output harder to scan, not easier.
Send data down the pipeline with Write-Output
Show a progress bar with Write-Progress
Updated 25 October 2026. Browser outputs are fictional; check the installed module help for your environment.
Recap
Write-Host Use Write-Host to display coloured messages in the console — status updates, warnings, and headings that stand out from normal output.
Next: Write Progress