Monthly Archives: September 2007

Effective PowerShell Item 9: Regular Expressions – One of the Power Tools in PowerShell

Windows PowerShell is based on the .NET Framework.  That is, it is built using the .NET Framework and it exposes the .NET Framework to the user.  One very nice feature of the .NET Framework is the Regex class in the System.Text.RegularExpressions namespace.  … Continue reading

Posted in Effective PowerShell | 2 Comments

Effective PowerShell Item 8: Output Cardinality – Scalars, Collections and Empty Sets – Oh My!

In the last post Effective Powershell Item 7: Understanding "Output", we covered a lot about PowerShell output.  However there is a bit more you need to understand to use PowerShell effectively.  This post concerns the cardinality of PowerShell output.  That … Continue reading

Posted in Effective PowerShell | 9 Comments

Effective PowerShell Item 7: Understanding “Output”

In shells that you may have used in the past, everything that appears on the stdout and stderr streams is considered "the output".  In these other shells you can typically redirect stdout to a file using the redirect operator ‘>’.  And … Continue reading

Posted in Effective PowerShell | 9 Comments

Effective PowerShell Item 6: Know What Objects Are Flowing Down the Pipe

To use Windows PowerShell pipes effectively, it really helps to know what objects are flowing down the pipe.  Sometimes objects get transformed from one type to another.  Without the ability to inspect what type is being used at each stage … Continue reading

Posted in Effective PowerShell | 1 Comment

Interface Design: Pragmatism vs Dogmatism

Someone pointed out this blog post to me: http://kirillosenkov.blogspot.com/2007/08/choosing-interface-vs-abstract-class.html The following quote concerns me: "An interface should define at most one member." I cringe at hard-and-fast rules like this.  I understand the author’s sentiment but I guess I would have … Continue reading

Posted in Software Development | 2 Comments

Effective PowerShell Item 5: Use Set-PSDebug -Strict In Your Scripts – Religiously

Windows PowerShell is like most dynamic languages in that it allows you to use a variable without declaring its type and without having assigned to it.  This is handy for interactive use, you can do stuff like this: PS C:\Temp> … Continue reading

Posted in Effective PowerShell | 5 Comments

Effective PowerShell Item 4: Commenting Out Lines in a Script File

OK the last couple of items have been long.  I promise a short one here.  Windows PowerShell doesn’t provide multiline comments.  Multiline comments come in handy when you need to comment out multiple lines in a script file.  However there is a reasonable … Continue reading

Posted in Effective PowerShell | 1 Comment