Dynamic parameters
Dynamic parameters allow a developer to define the behavior of parameters when a function is run, rather than hardcoding that behavior in advance in a param block. Dynamic parameters can be used to overcome some of the limitations inherent in a param block. For example, it is possible to change the parameters presented by a command based on the value of another parameter. It is also possible to dynamically write validation, such as dynamically assigning a value for the ValidateSet attribute.
Dynamic parameters remain unpopular in the PowerShell community. They are relatively complex; that is, they are hard to define, and difficult to troubleshoot as they tend to silently fail rather than raising an error. Dynamic parameters ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access