Chapter 10. Avoiding the pipeline
Jeff Wouters
Whether you’re new to PowerShell or you’re at a more advanced level, I encourage you to always consider performance and execution time when you write a script.
One of the most powerful features of PowerShell is its ability to use the pipeline. Finding objects, filtering them to return the ones you want, and performing an action on those objects is easy to do with pipelined expressions, which I refer to as the pipeline. Every step is one pipe in the pipeline. In general, the fewer pipes you use, the shorter the execution time and the fewer resources that are used.
Although creating one-liners is easy to learn and understand, following best practices yields the best performance. If you don’t implement ...
Get PowerShell Deep Dives now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.