I use scriptblocks quite a bit in my PowerShell work, often saved as variables. These are handy for commands you want to run again, but don’t necessarily need to turn into permanent functions. $freec={(get-wmiobject win32_logicaldisk -filter “deviceid=’c:'” -property Freespace).FreeSpace/1mb} Now in PowerShell I can invoke the scriptblock. PS S:\> &$freec 94079.72265625 Ok then. I have…
Tag: Get-variable
Get My Variables
As you might imagine I write a lot of PowerShell scripts and examples. Often my PowerShell Window is open for days at a time. One challenge I have always has is trying to remember what variables I have defined. If I knew the name I’d simply use Get-Variable. What I really want is a way…