-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Description
Summary of the new feature/enhancement
Back in Powershell 5, I could write a script which contained:
> $cred = Get-Credential -UserName "$first.$last"A dialog would then appear, asking for the password, but it also gave the option of changing what the username was. This was useful as you could implement a naming standard, but when there was an edge case allowed the end user to be able to easily override it.
This workflow could be built into many scripts wanting to upgrade from Windows Powershell to Powershell 7.
Proposed technical implementation details (optional)
Reading #10625 I thought a -ConfirmUserName switch would be consistent, but a -DefaultUserName Username string would work just as well.
The below is how I saw it being used, being consistent with other command line tools
> $cred = Get-Credential -UserName "john.smith" -ConfirmUserName
> $cred = Get-Credential -DefaultUserName "john.smith"
PowerShell credential request
Enter your credentials.
User [john.smith]: The User can just press enter without typing anything and it will use the default value.
It would be nice if the value was presented as pre-typed - as this would allow the user to manipulate the value instead of either choose the default, or write it again from scratch.