PromptForChoice
$one = new-object System.Management.Automation.Host.ChoiceDescription '&one' , 'First option'
$two = new-object System.Management.Automation.Host.ChoiceDescription '&two' , 'Second option'
$three = new-object System.Management.Automation.Host.ChoiceDescription 't&hree', 'Third option'
$options = [System.Management.Automation.Host.ChoiceDescription[]]($one, $two, $three)
$default = 2
$result = $host.ui.PromptForChoice('What now?', 'Choose an option', $options, $default)
write-host "OK: $($result+1)"
PromptForCredential
$cred = $host.ui.promptForCredential('Connecting to XYZ', 'Enter username and password.', '', 'XYZ')
Connecting to XYZ
Enter username and password.
User: rene
Password for user rene: ********
write… methods
$host.ui.write('text')
$host.ui.writeDebugLine('xyz was called')
$host.ui.writeErrorLine('wrong input.')
$host.ui.writeInformation('info')
$host.ui.writeLine('just a line')
$host.ui.writeProgress(…)
$host.ui.writeVerboseLine(…)
$host.ui.writeWarningLine(…)