Tag Archives: ScriptBlock

Re-Use PowerShell Scriptblocks

//Re-Use PowerShell Scriptblocks// I commented on a blog post today that showed how to use a hash table with Select-Object to format file sizes say as KB. dir $env:temp -rec | select fullname,@{Name="KB";Expression={$_.length/1kb}} Since you most likely will want to … Continue reading

Posted in Google Plus | Tagged , , | Leave a comment

Friday Fun What a CHAR!

Last week I posted a PowerShell snippet on Twitter. My original post piped an array of integers as [CHAR] type using an OFS. Don’t worry about that. As many people reminded me, it is much easier to use the -Join … Continue reading

Posted in Friday Fun, PowerShell v2.0 | Tagged , , , , | 3 Comments

The PowerShell Day Care: Building ScriptBlocks

Good morning kids and welcome to the PowerShell Day Care center. We offer a creative and nurturing environment for PowerShell professionals of all ages. Later there might even be juice and cookies. But first let’s get out our blocks, our … Continue reading

Posted in PowerShell, Scripting | Tagged , , , | 5 Comments

Get Properties with Values

One of my nuisance issues when using WMI with Windows PowerShell, is that when looking at all properties I have to wade though many that have no value. I’d prefer to only view properties that have a populated value. Here’s … Continue reading

Posted in PowerShell, PowerShell v2.0, WMI | Tagged , , , , | Comments Off

ScriptBlocks On the Fly

I’m always preaching about writing PowerShell scripts and functions with reuse and modularization in mind. You should never have to write the same block of code twice. But what about in the shell during your daily grind? Perhaps today you’re … Continue reading

Posted in PowerShell, Scripting | Tagged , , , | 1 Comment