Pages

8/16/2013

Powershell - prompt for option



$title = "Install Time"
$message = "Select Time For WSUS Install on SATURDAY"

$One = New-Object System.Management.Automation.Host.ChoiceDescription "&1 = 8pm", `
    "8 PM"

$two = New-Object System.Management.Automation.Host.ChoiceDescription "&2 = 9pm", `
    "9 PM"

$three = New-Object System.Management.Automation.Host.ChoiceDescription "&3 = 10pm", `
    "10 PM"

$four = New-Object System.Management.Automation.Host.ChoiceDescription "&4 = 11pm", `
    "11 PM"

$options = [System.Management.Automation.Host.ChoiceDescription[]]($one, $two, $three, $four)

$result = $host.ui.PromptForChoice($title, $message, $options, 0) 

switch ($result)
    {
        0 {$tod=20}
        1 {$tod=21}
 2 {$tod=22}
 3 {$tod=23}
    }
#"Time of Day for Install = $tod"

No comments: