When you type “h” in PowerShell, you see the PowerShell History of commands in your session.

Also, pressing F7 Key in PowerShell console brings up a command history dialog box  where you can choose and run history items like in the following image

Better PowerShell History Function

But this feature doesn’t work in Powershell ISE or any other script editor.
Well to the rescue following is a quick function which uses Out-GridView cmdlet to mimic the similar behavior like in the above image.

Better PowerShell History Function : 

Not only this function allows you to just run the history items, but you can also select and run multiple of history items at once as in the following image.

Better PowerShell History Function

When you hit OK, you’ll see all history items executed and echoed in your PowerShell console

Better PowerShell History Function

Add this function to your Powershell profile and always keep it handy, to add it to your profile using the below oneliner –

Hope you’ll find it useful, cheers!

Subscribe to our mailing list

* indicates required