PowerShell: Why the Count Property or += Don’t Work Sometimes

One thing that I occasionally forget (and it can take me a while to remember the fix) is some apparently strange behaviour when processing an array.  Sometimes array-based methods don’t work when there’s only one item (or no items!) to be processed.

It’s all down to PowerShell’s automatic type conversion and is pretty easy to fix. Continue reading “PowerShell: Why the Count Property or += Don’t Work Sometimes”