liveBook · Manning

Param block

Also called parameter block

A parameter block is a PowerShell construct that declares a script or function’s parameters, default values, and related metadata.

How 2 Manning books explain it

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.

Read how Practical Automation with PowerShell: Effective scripting from the console to the cloud explains param block →

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.

Read how Learn PowerShell in a Month of Lunches: Fourth Edition, Covers Windows, Linux, and macOS explains param block →

Also covered in

What to know first

Related concepts

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.