Skip to main content

Show-DialogBox

SYNOPSISโ€‹

Display a custom dialog box with optional title, buttons, icon and timeout.

Show-InstallationPrompt is recommended over this function as it provides more customization and uses consistent branding with the other UI components.

SYNTAXโ€‹

Show-DialogBox [-Text] <String> [-Title <String>] [-Buttons <String>] [-DefaultButton <String>]
[-Icon <String>] [-Timeout <String>] [-TopMost <Boolean>] [<CommonParameters>]

DESCRIPTIONโ€‹

Display a custom dialog box with optional title, buttons, icon and timeout. The default button is "OK", the default Icon is "None", and the default Timeout is None

EXAMPLESโ€‹

EXAMPLE 1โ€‹

Show-DialogBox -Title 'Installed Complete' -Text 'Installation has completed. Please click OK and restart your computer.' -Icon 'Information'

EXAMPLE 2โ€‹

Show-DialogBox -Title 'Installation Notice' -Text 'Installation will take approximately 30 minutes. Do you wish to proceed?' -Buttons 'OKCancel' -DefaultButton 'Second' -Icon 'Exclamation' -Timeout 600 -Topmost $false

PARAMETERSโ€‹

-Textโ€‹

Text in the message dialog box

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Titleโ€‹

Title of the message dialog box

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: $installTitle
Accept pipeline input: False
Accept wildcard characters: False

-Buttonsโ€‹

Buttons to be included on the dialog box. Options: OK, OKCancel, AbortRetryIgnore, YesNoCancel, YesNo, RetryCancel, CancelTryAgainContinue. Default: OK.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: OK
Accept pipeline input: False
Accept wildcard characters: False

-DefaultButtonโ€‹

The Default button that is selected. Options: First, Second, Third. Default: First.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: First
Accept pipeline input: False
Accept wildcard characters: False

-Iconโ€‹

Icon to display on the dialog box. Options: None, Stop, Question, Exclamation, Information. Default: None

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Timeoutโ€‹

Timeout period in seconds before automatically closing the dialog box with the return message "Timeout". Default: UI timeout value set in the config XML file.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: $configInstallationUITimeout
Accept pipeline input: False
Accept wildcard characters: False

-TopMostโ€‹

Specifies whether the message box is a system modal message box and appears in a topmost window. Default: $true.

Type: Boolean
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: True
Accept pipeline input: False
Accept wildcard characters: False

CommonParametersโ€‹

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTSโ€‹

Noneโ€‹

You cannot pipe objects to this function.โ€‹

OUTPUTSโ€‹

System.Stringโ€‹

Returns the text of the button that was clicked.โ€‹

NOTESโ€‹

https://psappdeploytoolkit.com