Clear-Host | Taking on PowerShell one cmdlet at a time | Weekly Blog

Share this post:

This is a part of an on-going blog series written by Adam Gordon. Each week, Adam will walk you through a PowerShell command, showing you when and how to use each one. This week, Adam covers Clear-Host. 

When to use Clear-Host?

The Clear-Host function removes all text from the current display, including commands and output that might have accumulated. When complete, it displays the command prompt. You can use the function name or its alias, cls.

Clear-Host affects only the current display. It does not delete saved results or remove any items from the session. Session-specific items, such as variables and functions, are not affected by this function.

Because the behavior of the Clear-Host function is determined by the host program, Clear-Host might work differently in different host programs.

What version of PowerShell am I using for this blog?

Get the PowerShell Version from your machine:


This command shows you the PowerShell version information on your machine.

How to use Clear-Host?

Use Clear-Host to clear the current display: 


Clear-Host is a simple function, not an advanced function. As such, you cannot use common parameters, such as –Debug, in a Clear-Host command.



Learn last week’s command Get-History here.

Need PowerShell training? Check out ITProTV’s PowerShell online IT training courses.