Skip to content
ConsoleMonster
Cmdlet

Read-ConsoleMultiSelection

Module ConsoleMonster
Inputs
System.Object[]

Asks the user to pick any number of the choices and returns the chosen objects.

Syntax

Read-ConsoleMultiSelection [-Badge <Object>] [[-Choices] <Object[]>] [-Collapsed] [-Describe <Object>] [-Description <String>] [-Disabled <ScriptBlock>] [-Display <Object>] [-GroupBy <Object>] [-Hotkey <Object>] [-Maximum <Int32>] [-Minimum <Int32>] [-Mode <Rich|Line|Accessible>] [-PageSize <Int32>] [-ParameterName <String>] [-Preview <ScriptBlock>] [-Selected <Object>] [-Title] <String> [<CommonParameters>]
#
Parameter set: All Parameter Sets

Description

Asks the user to pick any number of the choices and returns the chosen objects.

Everything Read-ConsoleSelection does, plus checkboxes: Space toggles (on a group it toggles the whole group, shown as [–] when partly selected; Left and Right collapse and expand groups), Ctrl+A selects all shown, Ctrl+N none, Ctrl+T inverts, Ctrl+O shows only the selected ones. -Minimum and -Maximum are enforced, and a live count shows how many are selected. The chosen objects are written to the pipeline in list order.

Examples

Authored help example

EXAMPLE 1

Read-ConsoleMultiSelection -Title 'Value'

Parameters

-Badge Object optional
Short right-aligned text per choice: a property name or a scriptblock.
-Choices Object[] optionalposition: 1pipeline: True (ByValue)aliases: InputObject, Items
The choices: any objects (strings, services, records). The chosen objects themselves are returned.
-Collapsed SwitchParameter optional
Starts with every group collapsed.
-Describe Object optionalaliases: DescriptionProperty
A sentence for the focused choice: a property name or a scriptblock.
-Description String optional
Help text under the question.
-Disabled ScriptBlock optional
Returns why a choice is unavailable ($_ is the choice), or nothing when it is available.
-Display Object optionalaliases: DisplayProperty
What to show for a choice: a property name or a scriptblock ($_ is the choice). Default: the choice as text.
-GroupBy Object optional
The group heading of a choice: a property name or a scriptblock.
-Hotkey Object optional
A key that picks a choice directly: a property name or a scriptblock returning a letter.
-Maximum Int32 optional
The most choices accepted.
-Minimum Int32 optional
The fewest choices accepted.
-Mode InteractionMode optional
Forces how to ask: Rich (in-place prompt), Line (question and typed answer), Accessible (numbered, no redraws) or None (use the default or fail).
Possible values: Rich, Line, Accessible
-PageSize Int32 optional
The preferred number of visible rows.
-ParameterName String optionalaliases: Parameter
The parameter of your script that supplies this value without a prompt (named in the non-interactive error, for example -Domain).
-Preview ScriptBlock optional
Content for the preview pane ($_ is the focused choice): text, rich text, a widget, or an object shown as a list.
-Selected Object optionalaliases: Default
Pre-selected choices: the objects or their displayed texts, or a scriptblock returning $true for selected ones.
-Title String requiredposition: 0aliases: Prompt, Question
The question.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.