Prompting for Secret Passwords via Console

by Sep 24, 2010

Whenever you need to enter credentials, you can either use Get-Credential or a low- level PS API function like so:

$c = $host.ui.PromptForCredential('Log on', $null, 'test\user', 'target')
$c

You should nNote that the low- level function will allow you to set dialog captions and a custom message. For a custom message, you should replace $null with your message string.

Twitter This Tip! ReTweet this Tip!