Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGet-Credential Ability to Override Username #12222
Comments
|
I like @cpmcgrath Do you want to implement this proposal and #10625? |
|
hello people , |
|
@oumolayna You can new issue with feedback for discussion. |
|
I'd be happy to look at implementing this, but it will probably be a few weeks before I get the chance |
|
Just reading through the code to this MshHostUserInterface has an overload which takes options through an enum PSCredentialUIOptions. The implementation in ConsoleHostUserInterfaceSecurity doesn't do anything with these options. There's 4 different enum values:
This seems like the mechanism that should be used, and these values imply to me that the default behaviour should be give the user a chance to override the Username |
|
I think we can use the enum. |
|
As mentioned in my original comment, having it prompt for the Username regardless would make it more consistent with Windows Powershell. But yes, potential breaking change if you had redirected Standard In. I'd think that would be very low risk though |
…s the ReadOnlyUserName option is passed in, it will always prompt for a UserName.
…s the ReadOnlyUserName option is passed in, it will always prompt for a UserName.
|
Proposed change in cpmcgrath@0a12184 I'll hold off making a pull request until I get feedback if this is the solution we're after. |
cpmcgrath
mentioned this issue
Please make PR - we can discuss there and get progress step by step. |


Summary of the new feature/enhancement
Back in Powershell 5, I could write a script which contained:
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
-ConfirmUserNameswitch would be consistent, but a-DefaultUserName Usernamestring would work just as well.The below is how I saw it being used, being consistent with other command line tools
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.