Search notes:

System.Management.Automation.Host.PSHostUserInterface (abstract class)

The «current» instance of PSHostUserInterface can be optained in the command line of PowerShell via $host.UI:
PS> $host.UI.GetType().FullName

Properties and methods

Prompt()
PromptForChoice()
PromptForCredential()
RawUI A reference to a System.Management.Automation.Host.PSHostRawUserInterface object.
ReadLine()
ReadLineAsSecureString()
SupportsVirtualTerminal true if host supports VT100 like terminals
Write()
WriteDebugLine()
WriteErrorLine()
WriteInformation()
WriteLine()
WriteProgress()
WriteVerboseLine()
WriteWarningLine()

Prompt()

$caption = 'Data enter'
$message = 'Please enter the following information:'
$fieldDescriptions = [System.Management.Automation.Host.FieldDescription[]] @(
    [System.Management.Automation.Host.FieldDescription]::new('valOne'  ),
    [System.Management.Automation.Host.FieldDescription]::new('valTwo'  ),
    [System.Management.Automation.Host.FieldDescription]::new('valThree')
)

$info = $host.UI.Prompt($message, $caption, $fieldDescriptions)
write-host "Val one: $($info.valOne), val two: $($info.valTwo) and val three: $($info.valThree)."

See also

System.Management.Automation.Host.PSHostRawUserInterface

Index