<# .SYNOPSIS Make a GUI Message Box visible to the user .EXAMPLE * Windows Forms: Add-Type -AssemblyName System.Windows.Forms [System.Windows.Forms.MessageBox]::Show('Hello') .LINK https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.messagebox .EXAMPLE * PresentationFramework: Add-Type -AssemblyName PresentationFramework [System.Windows.MessageBox]::Show('Hello') .LINK https://docs.microsoft.com/en-us/dotnet/api/system.windows.messagebox #> # MessageBox Dialog $Title = 'MessageBox Example' $Message = 'What action do you wish to take?' $ButtonType = 'YesNoCancel' $MessageIcon = 'Error' Add-Type -AssemblyName PresentationFramework $msgBoxInput = [System.Windows.MessageBox]::Show($Message, $Title, $ButtonType, $MessageIcon) switch ($msgBoxInput) { 'Yes' { Write-Output "You clicked 'Yes'" } 'No' { Write-Output "You clicked 'No'" } 'Cancel' { Write-Output "You clicked 'Cancel'" } }