Greetings experts
Trying to get the following function retry option to work. The Abort works but no matter what combinations I've tried can't get the Retry (start the entry process again) to work. Right now the Retry option does nothing, click it over and over and nothing. This is beyond my ability to figure out
Any input would be greatly appreciated.
Norm
function FOO1
{
[CmdletBinding()]
param(
[Parameter(Mandatory,HelpMessage="Enter a Datacenter Name")]
[String]$DCChoice
)
$exitFlag = $False
Do
{
Try
{
$DC = Get-DataCenter -Name $DCChoice -ErrorAction Stop
$exitFlag = $true
}
Catch
{
$DC = $null
$title = "Invalid DataCenter Name"
$prompt = "$DCChoice Invalid DataCenter Name, Would you like to [A]bort or [R]etry?"
$choices = @('&Abort','&Retry')
$choice = $host.ui.PromptForChoice($title,$prompt,$choices,0)
If($choice -eq 0){$exitFlag = $true}
##If($choice -ne 0){$exitFlag = $False}
}
}Until($exitFlag -gt 0)
If([String]::IsNullOrEmpty($DC))
{
Return 'NotProcessed'
}
$DCChoice
}