PowerShell turns out has a great memory, and can help you with those tedious list of commands you’ve entered time over time. No worries if you’ve closed the PowerShell window, rebooted your machine, PowerShell will remember your history.
In most cases, that would be an awesome feature. However…. if you’ve ever tried to prep a VM, or otherwise tried to clear your history, perhaps a username and/or passowrd is in the list, you may wonder how to clear it.
You may find the Clear-History command. You may even run it. And, if you hit the up arrow, you’ll find your history now includes the Clear-History command…
Well, if you want to clear the history, or actually pre-load the history with a list of commands to be used in a Lab VM, here’s where you go:
You can turn it off with:
Set-PSReadlineOption –HistorySaveStyle SaveNothing
Or point to a different location with:
And if you want to delete your history:
Yet another thing that’s really simple, once you know the answer…
Thanks to Jason Shirk from the PowerShell team