Home Virtualization Quickly View and Repeat PowerCLI/Powershell Commands Easily

Quickly View and Repeat PowerCLI/Powershell Commands Easily

by admin

I came across this tip recently on Twitter – though I didn’t make a note of the source at the time. It was related to a Powershell question, though is equally useful for PowerCLI of course..

Running the following Powershell one liner, presents a list of all the commands run previously in the session (basically get-history), but displays it in a pop up window. You can then select any line, then click OK, to run any of your previous commands again.

h | ogv -p | r

You can then select any item in your PowerCLI/Shell session history, and run it again by clicking ‘OK’:

powercli-hist

Note that you can also use the filter box to search for a particular command. As this uses out-gridview you will need the Powershell ISE installed.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More