Powershell Get-History+


When you hit F7 in PowerShell console it brings up a command history dialog box  where you can choose and run history items like in the following image

f7

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 simmilar behavior like in the above image.

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

f7

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

f7

 

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

Hope you’ll find it useful, cheers!

signature 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s