© Adam Bertram 2020
A. BertramBuilding Better PowerShell Codehttps://doi.org/10.1007/978-1-4842-6388-4_16

16. Build Scripts for Speed

Adam Bertram1  
(1)
Evansville, IN, USA
 

Although this chapter conflicts with tips on not purely focusing on performance, there’s a fine line to follow. On the one hand, you don’t need to get bogged down shaving off microseconds of runtime. On the other hand, though, you shouldn’t completely disregard script performance.

There is a gray area that you need to stay within to ensure a well-built PowerShell script.

Don’t Use Write-Host in Bulk

Although some would tell you never to use the Write-Host cmdlet , it still has its place. But, with the functionality, it brings also a small performance hit. Write-Host does nothing ...

Get Building Better PowerShell Code: Applying Proven Practices One Tip at a Time 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.