Param block
A parameter block is a PowerShell construct that declares a script or function’s parameters, default values, and related metadata.
Practical Automation with PowerShell: Effective scripting from the console to the cloud
A parameter block is the section of a PowerShell function or script that declares its input parameters and their metadata.
- How it is used
- Defines the required and optional inputs that drive reusable archive and log-cleanup automations.
- How deep it goes
- Explains placement, mandatory flags, types, and defaults through complete function and script listings.
- Examples
- Demonstrates archive-path inputs, a date parameter, and a 30-day log-retention setting in a cleanup script.
- What you can do after
- Apply it via PowerShell functions and scripts to declare typed, required, and optional automation inputs.
Learn PowerShell in a Month of Lunches: Fourth Edition, Covers Windows, Linux, and macOS
A param block is a PowerShell language construct that declares the parameters and default values of a script or function.
- How it is used
- Turns hardcoded script values into inputs for repeatable administrative commands.
- How deep it goes
- Explains declarations, defaults, invocation forms, types, mandatory attributes, and block punctuation through working scripts.
- Examples
- Uses Get-DiskInventory with computer-name and drive-type parameters, including mandatory prompting and typed values.
- What you can do after
- Apply it via PowerShell scripts to replace hardcoded values with named, positional, defaulted, or mandatory inputs.
Also covered in
What to know first
- stringA string is a programming-language value or data type representing an ordered sequence of text characters or encoded units.
- arrayAn array is an ordered collection of elements organized in one or more dimensions and accessible by position or index.
- bindingName binding is the association of an identifier with the program entity or value it denotes.
Related concepts
- inputhas part · An input is information, a value, or an action supplied to a system, program, or computation for processing or to influence its behavior.
- CmdletBinding attributehas part · The CmdletBinding attribute is a PowerShell declaration that enables cmdlet-like behavior and advanced features for a script or function.
- functionpart of · A function is a callable unit of program code that performs a computation or operation, can accept inputs, and may produce a result or side effect.
- shell scriptpart of · A shell script is a text program containing commands interpreted and executed by a command-line shell.
Questions about param block
What is param block?
A parameter block is a PowerShell construct that declares a script or function’s parameters, default values, and related metadata.
Which Manning books explain param block?
Practical Automation with PowerShell: Effective scripting from the console to the cloud and Learn PowerShell in a Month of Lunches: Fourth Edition, Covers Windows, Linux, and macOS.
What should I know before learning param block?
Manning books that teach param block usually introduce string, array and binding first.
What is param block part of?
Param block is part of function. A function is a callable unit of program code that performs a computation or operation, can accept inputs, and may produce a result or side effect.
What are the parts of param block?
Param block includes input and CmdletBinding attribute.
What is param block also called?
Param block is also called parameter block.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

