$Answer = [Windows.Forms.MessageBox]::Show("DJIA has dropped by 300 points today `n Do you want to `n go to your IRA?", "Trade Alert",
If ($Answer -eq "Yes")
Write-Host "Do Something."
Clicking on this item, we are taken to the MessageBox.Show Method (String, String, MessageBoxButtons, MessageBoxIcon) method on MSDN. Here we can see that the first string is the message and the second is the caption on the message box window.
From here, if we click on System.Windows.Forms.MessageBoxButtons, we can see the types of buttons that we have access to.
In this example, we are using YesNo. Yes or No will be returned and stored in $Answer
We are also choosing an icon for this message box from MessageBoxIcon. Here are valid options are:
In the end, this is what you will see:
Either the string Yes or No will be returned when the appropriate button is clicked.