Erhalte den nächsten Index als dreistellige Zahl
Get the next index as a three-digit number
Parameters are defined at the first non-comment line within a script of function.
Specify data types of parameters
Identify flag
- Boolean is true or false.
Identify specific type
Validate out of predefined options
- Enables AutoComplete.
Provide default values
Set default value
Set default via command
Identify optional public properties of parameters
Require parameter
Attribute | Default | Description |
---|---|---|
Mandatory | false | Make parameter mandatory and prompt for value when the user does not supply one |
ParameterSetName | Define mutually exclusive parameters | |
Position | Assign positions to parameters and use arguments without parameter names | |
ValueFromPipeline | false | Assign pipeline input to a parameter |
ValueFromPipelineByPropertyName | Assign a specific property of pipeline input to a parameter | |
ValueFromRemainingArguments | false | Create a ParamArray and assign any unbound argument to a parameter |
DontShow | false | Hide parameter in IntelliSense and tab completion |
HelpMessage | Provide a help message for mandatory parameters | |
HelpMessageBaseName | Name of resource assembly that contains compiled help messages | |
HelpMessageResourceId | Resource identifier for help message |
Sources:
- 2022-11-14: Designing Professional Parameters - powershell.one
- 2023-03-03: Parameter Attribute Declaration - PowerShell | Microsoft Learn
- 2023-03-23: function to accept array from pipe
- 2023-03-27: PowerShell Advanced Functions | ScriptRunner
Related:
Naming Convention - Name PowerShell functions with one of the predefined verbs
Tags:
Programm PowerShell - Learn PowerShell’s programming paradigms