Prompting for Credentials
suggest changeTo prompt for credentials, you should almost always use the Get-Credential
cmdlet:
$credential = Get-Credential
Pre-filled user name:
$credential = Get-Credential -UserName 'myUser'
Add a custom prompt message:
$credential = Get-Credential -Message 'Please enter your company email address and password.'
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents