Category Archives: Effective PowerShell

Effective PowerShell Item 16: Dealing with Errors

There are several facets to the subject of errors in PowerShell that you should understand to get the most out of PowerShell.  Some of these facets are error handling, error related global variables and error related preference variables.  But the … Continue reading

Posted in Effective PowerShell | 6 Comments

Effective PowerShell Item 15: Using the Output Field Separator $OFS

$OFS is the “output field separator” variable.  Whatever value it contains will be used as the string separator between elements of an array that is rendered to a string.  For example, consider the following array definition and subsequent rendering to … Continue reading

Posted in Effective PowerShell | Leave a comment

Effective Windows PowerShell: The Free eBook

I’ve gotten some requests to turn my Effective PowerShell blog posts into booklet form which I have done.  I expect that this document will grow over time as I add new items.  If you have feedback (typos, suggestions, etc) please … Continue reading

Posted in Effective PowerShell | 19 Comments

Effective PowerShell Item 14: Capturing All Output from a Script

Both version 1 and version 2 of Windows PowerShell have a nasty limitation when it comes to capturing *all* output from a script.  First up, within a script there is no way to redirect host (Write-Host), verbose, warning and debug … Continue reading

Posted in Effective PowerShell | 11 Comments

Effective PowerShell Item 13: Comparing Arrays in Windows PowerShell

PowerShell has a lot of useful operators such as -contains which tests if an array contains an particular element.  But as far as I can tell PowerShell doesn’t "seem" to provide an easy way to test if two array’s contents … Continue reading

Posted in Effective PowerShell | 6 Comments

Effective PowerShell Item 12: Understanding ByValue Pipeline Bound Parameters

In item 11, I covered ByPropertyName pipeline bound parameters.  In this post, I’ll cover the other variety of pipeline binding – ByValue.  ByValue binding takes the input object itself and attempts to bind it by type using type coercion if … Continue reading

Posted in Effective PowerShell | 6 Comments

Effective PowerShell Item 11: Understanding ByPropertyName Pipeline Bound Parameters

Everybody likes to be efficient, right?  I mean we all generally like to solve a problem in an efficient way.  In PowerShell that usually culminates in a "one-liner".  Honestly for pedagogical purposes I find it better much better to expand … Continue reading

Posted in Effective PowerShell | 3 Comments