Mastering PowerShell Parameters: Advanced Techniques and Best Practices
summary
Demonstrates concrete PowerShell 7 techniques: validate-script only runs on PowerShell 7 and use of the PS Script Tools module with get-type-member and the new PS dynamic parameter form WinForms generator; shows argument completers, validate-set and validate-range examples, and custom validation classes; recommends typing parameters as System.IO.DirectoryInfo instead of strings, warns not to default to "localhost", and walks through positional choices, aliases, mandatory flags and how those decisions affect pipeline binding and runtime failures.
AI-written summary · about
chapters (12)
- 0:00PowerShell parameter design
- 1:58Parameters in PowerShell functions
- 8:58Naming and defining parameters
- 13:30Positional vs named parameters
- 21:42Aliases for flexible input
- 29:09Parameter validation techniques
- 35:30Advanced validation with completers
- 37:16Custom types for parameters
- 40:05Deprecating and hiding parameters
- 43:19Dynamic parameters best practices
- 44:21Parameter pitfalls to avoid
- 46:07Summary and resources
related talks
01h 03mThe Zen of Powershell - PowerShell for the C# dev
01h 29mModularizing PowerShell: Making Code Portable
43mAdvanced PowerShell Eventing Scripting Techniques
45mPlatform PowerShell
52mBecome a parameter ninja
44mEmpower your Helpdesk : Turn Scripts into Dynamic...
47mBest practices for automating Azure with PowerShell...
45mUsing PowerShell to be a Linux Administrator
