Wednesday, October 28, 2015

Defining Parameters for PowerShell scripts

If you need to define arguments or parameters for your PowerShell scripts, you will want to take a look at this article:

Personally, when I define parameters for my PowerShell scripts, I prefer to use the [CmdletBinding()] syntax since it is more clear about the types of parameters as well as the order in which they need to appear.  I also receive meaningful error messages when I fail to pass in a parameter to my PowerShell script.

If you want to further manage your parameters, you can use Default Values for your parameters as outlined here:


No comments:

Post a Comment