Using untyped or [object] parameters
When writing a function with flexibility in mind, we might be tempted to omit a type on a parameter in order to allow the user to supply different kinds of objects as arguments. PowerShell definitely allows for this, and in PowerShell Version 1.0 this was a common practice. With PowerShell Version 2.0, and with the introduction of advanced functions and parameter sets, we have a better option.
Recall that PowerShell doesn't allow the overloading of functions, where multiple function definitions exist with distinct signatures. If it did, some built-in cmdlets would have over a dozen different definitions. Instead, the concept of parameter sets, or mutually exclusive sets of parameters, is provided. Each parameter set corresponds to a usage pattern of the function or cmdlet. For instance, the help for Rename-Item
shows two parameter sets:
Using a standard path
Using a literal path
The following screenshot shows the name, synopsis, and syntax of Rename-Item
...