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

15. Return Standardized, Informational Output

Adam Bertram1  
(1)
Evansville, IN, USA
 

Have you ever run a script or function you received from someone else and wondered if it worked? It ran without showing an error, but then again, it returned nothing at all! You don’t have a clue what it did nor could see its progress as it was executing.

Because it didn’t return any object to the pipeline, you also can’t use its outcome in other commands. You are forced to write more code to check whether it did its job which results in wasted time and added complexity.

In this chapter, you’re going to learn some tips on what to return to your user, how often, ...

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.