DEV Community

Cover image for PowerShell Parameter Attributes - validate, group, require params and add pipeline to your function
Kamil Pro
Kamil Pro

Posted on

PowerShell Parameter Attributes - validate, group, require params and add pipeline to your function

Having properly configured parameters help your users to understand the use of your function. It also helps fellow developers to appreciate the intended use of the function. In addition, it gives you more control of how the code flows through your script.

Parameter attributes is what takes parameters to the next level - you can specify that certain parameters are mandatory, group them together so that only certain combination of parameters is meant to work together, we can even add pipeline support so that function can be used as any other built-in function.

I will show you all the above with even more, as I always strive to go profoundly in PowerShell explanation!

Files available at: [https://github.com/kprocyszyn/About-PowerShell/tree/main/PowerShell%20Function/Parameters]

Top comments (0)