Prompt message to show in the message box shown to a user.
Aliases
Text
Required?
true
Position?
1
Default Value
​
Accept Pipeline Input?
false
Accept Wildcard Characters?
false
-DefaultValue <String>
Default value to be provided for the text box.
Aliases
Text
Required?
false
Position?
named
Default Value
​
Accept Pipeline Input?
false
Accept Wildcard Characters?
false
-Validation <String>
Regex for value validation. If user enters a value that does not validate - en error message defined with the "ErrorMessage" parameter will be shown and user will be asked to enter the value again.
Aliases
Text
Required?
false
Position?
named
Default Value
​
Accept Pipeline Input?
false
Accept Wildcard Characters?
false
-ErrorMessage <String>
Error message to show when regex validation fails.
Aliases
Text
Required?
false
Position?
named
Default Value
​
Accept Pipeline Input?
false
Accept Wildcard Characters?
false
-MaxLength <Int32>
Maximum length of the string returned. If user enters a longer value - en error message will be shown and user will be asked to enter the value again.
Aliases
Text
Required?
false
Position?
named
Default Value
​
Accept Pipeline Input?
false
Accept Wildcard Characters?
false
Outputs
The output type is the type of the objects that the cmdlet emits.
System.String
Notes
Help Author: Adam Najmanowicz, Michael West
Examples
EXAMPLE 1
Requests that the user provides an email, validates it against a regular expression snd whows an allert if the format is not valid
1
PS master:\> Show-Input"Please provide your email"-DefaultValue "[email protected]"-Validation "^[a-zA-Z0-9_-]+(?:\.[a-zA-Z0-9_-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?quot;-ErrorMessage "Not a proper email!"
Copied!
EXAMPLE 2
Uses Show-Input command to request user a new name for the content item validating the proper characters are used and assigns the result to $newName variable (nothing gets changed)
PS master:\> $newName = Show-Input"Please provide the new name for the '$($contentItem.Name)' Item"-DefaultValue $contentItem.Name -Validation "^[\w\*\$][\w\s\-\$]*(\(\d{1,}\)){0,1}quot;-ErrorMessage "Invalid characters in the name"
3
​
4
#print new name
5
PS master:\> Write-Host"The new name you've chosen is '$($newName)'"
Copied!
EXAMPLE 3
Requests that the user provides a string of at most 5 characters
1
Show-Input"Please provide 5 characters at most"-MaxLength 5