PowerShell Snippets: Prompt User for Password
Views (36)

In this last post, in this series, I showed a PowerShell snippet which would prompt a user for input. This is fine if you are prompting for a username, filename, version tag or similar, but if you are prompting for a password, you would not want to expose to people watching over the users shoulder.
The Read-Host
cmdlet has a parameter which will allow for secure prompting of passwords:
$Password = Read-Host "Enter your password" -AsSecureString
Adding the AsSecureString
parameter will prompt for the password with a popup input box which obscures the password during entry.
Click to show/hide the PowerShell Snippets Series Index
Read original post PowerShell Snippets: Prompt User for Password at azurecurve|Ramblings of an IT Professional
This was originally posted here.
*This post is locked for comments