I want to create a confirmation box. I want to have a popup box that says that it appears that this is the factory key. Do you wish to continue? and if so proceed with the rest of the script if not, exit script.
The following is my script:
if (Test-Path $USB2\sources\install3.swm) {
$caption = "*** IT APPEARS THIS IS A FACTORY KEY ***"
$message = "Are you Sure You Want To Proceed:"
[int]$defaultChoice = 1
$yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", "I understand, flash over it."
$no = New-Object System.Management.Automation.Host.ChoiceDescription "&No"
$options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no)
$choiceRTN = $host.UI.PromptForChoice($caption, $message, $options, $defaultChoice)
if ( $choiceRTN -ne 1 ) {
"Your Choice was Yes"
} else {
Stop-Process -Id $PID
}
}
See the bit, $options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no)
. Where I am stuck is the "Your Choice was yes" I don't need that... I just need it to continue with the script if yes. How do I do that?