Like This ...

Asking for Credentials

Whenever you need to enter credentials, you can either use Get-Credential or a low-level PS API function like:
$c = $host.ui.PromptForCredential('Log on', $null, 'test\user', 'target')
$c
You should note 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.

blog comments powered by Disqus