-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Description
Summary of the new feature/enhancement
Passwords are hard. When we prompt for passwords, especially for complex passwords, it's important to ensure that we know what we are entering. When using Get-Credential interactively from the command line, you currently only get one opportunity to type in your password. It's easy to fat finger a complex password. If you fat finger a complex password, then use it somewhere, you can make that resource inaccessible. We should enable a confirmation of the password when using this cmdlet interactively.
Proposed technical implementation details
Consider adding a -ConfirmPassword parameter that confirms two password strings entered at the command line are correct. If correct, proceed with saving the credential. If incorrect, re-prompt the user for matching strings. Something like this:
Successful entry
PS C:\> Get-Credential -credential user1 -ConfirmPassword
PowerShell credential request
Enter your credentials.
Password for user user1: ************
Confirm password for user user1: ************
UserName Password
-------- --------
user1 System.Security.SecureString
Unsuccessful entry
PS C:\> Get-Credential -credential user1 -ConfirmPassword
PowerShell credential request
Enter your credentials.
Password for user user1: *****
Confirm password for user user1: ************
Passwords do not match.
Enter your credentials.
Password for user user1: ************
Confirm password for user user1: ************
UserName Password
-------- --------
user1 System.Security.SecureString