Automation · PowerShell Automation
Parameters
Cheat sheet · https://pcornel.dk/topic.php?topic=5237
Answer
PowerShell parameters are declared in param() with types, Mandatory, defaults and validation such as ValidateSet or ValidatePattern, so bad input fails before the script acts.
Remember
- Parameters have types, Mandatory and defaults.
- ValidateSet, ValidatePattern and ValidateRange reject bad input.
- Parameters can take pipeline input.
First checks
Get-Help <script> -Parameter *— parameter docs- param() with [Parameter(Mandatory)] and validation attributes — validation
- Pipeline input support — design
Verify in this order
caller → param block → validated values
Where it usually breaks
Script/input → command/module binding → local/remoting session → request accepted → command result → target object read-back → effective runtime state → workload.
Parameters · PowerShell operational reference
| Boundary | Parameters reference |
|---|---|
| Runtime identity | PowerShell edition/version + command/module source |
| Persistent intent | Script/module/config prerequisites under source control |
| Verification | Read-only discovery → execution evidence → independent target read-back |
| Output contract | Structured objects/streams before formatting |
| Failure boundary | Separate engine/binding from transport/API/native and target-state failures |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5237