
Functions - PowerShell | Microsoft Learn
Jan 23, 2025 · Learn how to create reusable PowerShell functions, implement best practices, and avoid common pitfalls in function design, error handling, and parameter validation.
about_Functions_Advanced_Parameters - PowerShell
The following example shows a function with standard parameters named Name and Path, and an optional dynamic parameter named KeyCount. The KeyCount parameter is in the …
about_Functions - PowerShell | Microsoft Learn
Jul 16, 2025 · You can use parameters with functions, including named parameters, positional parameters, switch parameters, and dynamic parameters. For more information about …
about_Parameter_Sets - PowerShell | Microsoft Learn
Sep 29, 2025 · The Parameter attribute enables you to define the parameter differently for each parameter set. For example, you can define a parameter as mandatory in one set and optional …
Examples of Comment-based Help - PowerShell | Microsoft Learn
Mar 24, 2025 · This example shows how to insert parameter descriptions in the param statement of a function or script. This format is most useful when the parameter descriptions are brief.
about_Parameters - PowerShell | Microsoft Learn
Jan 19, 2024 · Most PowerShell commands, such as cmdlets, functions, and scripts, rely on parameters to allow users to select options or provide input. The parameters follow the …
about_Functions_Advanced - PowerShell | Microsoft Learn
Sep 29, 2025 · For more information about how to declare parameters, see about_Functions_Advanced_Parameters. The following example shows a function that …
about_Comment_Based_Help - PowerShell | Microsoft Learn
May 21, 2025 · This example is the same as the previous one, except that the parameter descriptions are inserted in the function syntax. This format is most useful when the …
Add Credential support to PowerShell functions - PowerShell
Nov 17, 2022 · This article shows you how to add credential parameters to PowerShell functions and why you'd want to. A credential parameter is to allow you to run the function or cmdlet as …
about_Splatting - PowerShell | Microsoft Learn
Sep 24, 2025 · This example shows how to override a splatted parameter using explicitly defined parameters. This is useful when you don't want to build a new hashtable or change a value in …