Skip to main content
Version: 4.1.x

Show-ADTDialogBox

SYNOPSIS

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

SYNTAX

Show-ADTDialogBox [-Text] <String> [-Buttons <DialogBoxButtons>] [-DefaultButton <DialogBoxDefaultButton>]
[-Icon <DialogBoxIcon>] [-NoWait] [-ExitOnTimeout] [-NotTopMost] [-Force] -Title <String> [-Timeout <UInt32>]
[<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.

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

EXAMPLES

EXAMPLE 1

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

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

-Buttons

The button(s) to display on the dialog box.

Type: DialogBoxButtons
Parameter Sets: (All)
Aliases:
Accepted values: Ok, OkCancel, AbortRetryIgnore, YesNoCancel, YesNo, RetryCancel, CancelTryContinue

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.

Type: DialogBoxDefaultButton
Parameter Sets: (All)
Aliases:
Accepted values: First, Second, Third

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.

Type: DialogBoxIcon
Parameter Sets: (All)
Aliases:
Accepted values: None, Stop, Question, Exclamation, Information

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

-NoWait

Presents the dialog in a separate, independent thread so that the main process isn't stalled waiting for a response.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

-ExitOnTimeout

Specifies whether to not exit the script if the UI times out.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

-NotTopMost

Specifies whether the message box shouldn't be a system modal message box that appears in a topmost window.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

-Force

Specifies whether the message box should appear irrespective of an ongoing DeploymentSession's DeployMode.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

-Timeout

Specifies how long to show the message prompt before aborting.

Type: UInt32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
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: True
Position: Named
Default value: None
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

PSADT.UserInterface.DialogResults.DialogBoxResult

Returns the text of the button that was clicked.

NOTES

An active ADT session is NOT required to use this function.

Tags: psadt
Website: https://psappdeploytoolkit.com
Copyright: (C) 2025 PSAppDeployToolkit Team (Sean Lillis, Dan Cunningham, Muhammad Mashwani, Mitch Richters, Dan Gough).
License: https://opensource.org/license/lgpl-3-0

https://psappdeploytoolkit.com/docs/reference/functions/Show-ADTDialogBox

Look for us at these events...

MMS: Music City Edition 2025
October 12th to 15th • Nashville, Tennessee, USA
Up Next
AppManage2025AppManage2025
October 10th • Utrecht, The Netherlands
MAEDS Fall Conference 2025MAEDS Fall Conference 2025
October 29th to 31st • Michigan, USA