The Community Book of Powershell Practices Master by Powershell.org - HTML preview

PLEASE NOTE: This is an HTML preview only and some elements such as links or page numbers may be incorrect.
Download the book in PDF, ePub, Kindle for a complete version.

“The PowerShell Way”

There is no one, true way to do anything in PowerShell. To resurrect a previous pair of examples:

````

[void]Do-Something

Do-Something | Out-Null

````

Same end effect, but some folks will argue that the first command is more “programmer-y” and less “PowerShell-y.” The first example runs faster, however, so there’s more than an aesthetic difference here.

It’s important to note that although PowerShell isn’t a programming language, it - like most good shells - does contain a programming language. It’s okay to use it. It’s fine to use more programming-style approaches. Don’t dismiss a technique or approach because ‘it looks like programming’ to you, and because you aren’t a programmer and don’t want to be one. You might actually be missing out on something.