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

6. Parameterize Everything

Adam Bertram1  
(1)
Evansville, IN, USA
 

One of the key differences between a simple script and a PowerShell tool are parameters. Parameters allow developers to write scripts that are reusable. Parameters don’t force developers to edit their scripts or functions every time they need to run them. They allow users to modify how the script or function works without modifying the code.

Parameters are an integral component of building a reusable PowerShell tool that turns ad hoc scripts into building blocks.

In this chapter, you’ll learn many different tips on how to properly use parameters in your daily life.

Don’t Hardcode. ...

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.