Search Documentation by Keyword

Read-UserEntry

You are here:
← All Topics

This is a utility cmdlet that captures input from the user and validates it against a regex pattern. If a default value is provided, the user can accept it by pressing Enter.

Syntax

Read-UserEntry `
    -Label <string> `
    [-Description <string>] `
    [-Default <string>] `
    [-Pattern <string>]

Parameters

ParameterRDescription
Label*Identifies the data being captured to the user.

Example: -Label "Height Above Sea Level"
DescriptionOptional description and/or instructions for user entry.

Example: -Description "The target SQL Server database server address."
DefaultDefault entry, which the user can accept by pressing the Enter key.

Example: -Default "0"
PatternRegex pattern against which user input will be validated.

Default: ".*"

Example: -Pattern "\d+"

×