How to clear the Command History in PowerShell window session

To get a list of commands you executed in a PowerShell Window session, we use “Get-History” PowerShell cmdlet. To clear the command history, you can use “Clear-History” as listed below:

To clear complete command history, type below command:

  • Clear-History

Each command, executed in the PowerShell Windows session, is assigned with an ID. To delete the commands with history IDs, use below command:

  • Clear-History -ID 12, 20

About Nirmal Sharma

Nirmal is a MCSEx3, MCITP and was awarded Microsoft MVP award in Directory Services. He is specialized in Directory Services, Microsoft Clustering, Hyper-V, SQL and Exchange and has been involved in Microsoft Technologies since 1994. In his spare time, he offers technical help by writing tips and articles. Nirmal can be reached at [email protected].

About The Author

2 thoughts on “How to clear the Command History in PowerShell window session”

Leave a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top