Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Prompt For Choice

$
0
0

Hi guys!

I've this little problem: i want to set a default value (YES) in my function if elapsed time >15" (or when the function is scheduled)  

My function is this:

Function Get-Choice{
    Param(
    [Parameter(Mandatory=$True,Position=0)]$Item
    )
    $Caption = "Exception Confirming."
    $Message = "Do you want to append this item ($item) to Exception List?"
    $Choices = [System.Management.Automation.Host.ChoiceDescription[]]`
    @("&Yes","&No")
    [Int]$DefaultChoice = 0
    $ChoiceRTN = $Host.UI.PromptForChoice($Caption, $Message, $Choices, $DefaultChoice)
    Switch ($ChoiceRTN){
        0 	{$True}
        1  	{break}
    }
}

I suppose i must use a timer... How can i do that?

Thanks

A


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>