I thought I’d share a short but useful PowerShell utility. This is something that is very handy when I am writing. As you know, PowerShell maintains a command history in your PowerShell session. You can view history with the Get-History cmdlet or its alias h. To re-rerun a command use Invoke-History or its alias r,…
Tag: History
PowerShell Sessions and VS Code
If you do any amount of PowerShell scripting you have most likely heard about Visual Studio Code. This is a free cross-platform light-weight editor from Microsoft. VS Code supports multiple languages and is extensible. I’ve tried different versions since it was first released but never found a reason to jump from the PowerShell ISE. For…
PowerShell Deep Dive Treasure
Without a doubt the PowerShell Deep Dive conference was one of the best meetings I’ve ever attended and I wanted to share one tidbit I came away with that I find immensely useful and never knew. During one of Bruce Payette’s talks he tossed out, practically as an aside, a reference to searching command line…
Get Variable Definition
Last week a question came across my email about how to find out where a variable came from. I thought this was a great question because I’ve run into this scenario as well. I see a variable but don’t recall what command I typed to create it. What I need is an easy way to…
Convert History to Script
Whenever I teach or speak about PowerShell, a recurring mantra is that there is no difference between running a PowerShell script and executing commands interactively in the shell, except that it saves you typing. You can create a PowerShell script by simply copying and pasting commands from the shell into a .PS1 text file. This…