Add-Type -AssemblyName System.Windows.Forms # --- Message Box with Title, Buttons, and Icon --- # Define the message and title for the message box. $message = "Alright then, buddy. I'm going to shit yourself." $title = "Warning" # Define the buttons and icon for the message box. $buttons = [System.Windows.Forms.MessageBoxButtons]::OK $icon = [System.Windows.Forms.MessageBoxIcon]::Warning # Display the message box and capture the user's response. $result = [System.Windows.Forms.MessageBox]::Show($message, $title, $buttons, $icon) # --- Documentation of Available Options --- # The basic syntax for the MessageBox is: # [System.Windows.Forms.MessageBox]::Show("Message", "Title", [Buttons], [Icon]) # --- Button Options --- # You can specify different button combinations using the [System.Windows.Forms.MessageBoxButtons] enumeration. # The available options are: # # OK: Displays an "OK" button. # OKCancel: Displays "OK" and "Cancel" buttons. # AbortRetryIgnore: Displays "Abort", "Retry", and "Ignore" buttons. # YesNoCancel: Displays "Yes", "No", and "Cancel" buttons. # YesNo: Displays "Yes" and "No" buttons. # RetryCancel: Displays "Retry" and "Cancel" buttons. # Example of using a different button set: # $buttons = [System.Windows.Forms.MessageBoxButtons]::OKCancel # --- Icon Options --- # You can display an icon in the message box using the [System.Windows.Forms.MessageBoxIcon] enumeration. # The available options are: # # None: No icon is displayed. # Error (or Hand, Stop): A red circle with a white 'X'. # Question: A blue circle with a white question mark. # Warning (or Exclamation): A yellow triangle with a black exclamation mark. # Information (or Asterisk): A blue circle with a white lowercase 'i'. # Example of using a different icon: # $icon = [System.Windows.Forms.MessageBoxIcon]::Warning