Search notes:

Powershell: $host.ui

$host.ui is a System.Management.Automation.Internal.Host.InternalHostUserInterface object.

PromptForCredential

$host.ui.promptForCredential(…) can be used to get a System.Management.Automation.PSCredential object from a username and a password.
$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: ********
Compare with the get-credential cmdLet.

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(…)
Compare with the respective write cmdlets.

TODO

$host.ui.supportsVirtualTerminal
$host.ui.prompt(…)
$host.ui.promptForChoice(…)
$host.ui.readLineAsSecureString()

See also

$host.ui.rawUI

Index