You can create a custom invitation with several options using System.Management.Automation.Host.ChoiceDescription
$Yes = New-Object System.Management.Automation.Host.ChoiceDescription "Yes Please" $No = New-Object System.Management.Automation.Host.ChoiceDescription "No, Thank you" $YesNoChoices = [System.Management.Automation.Host.ChoiceDescription[]]($No,$Yes) $Answer = $Host.UI.PromptForChoice("Caption goes here", "Message Goes here", $YesNoChoices, 1)
This will create a similar user interface that you get with -confirm or -whatif, but you can specify the answers you want. This will work in any PowerShell Host, ISE or PowerShell.exe.
source share