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’:
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.Keep up to date with new posts on Buildvirtual.net - Follow us on Twitter: Follow @buildvirtual