web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :

PowerShell Snippets: Prompt User for Password

Ian Grieve Profile Picture Ian Grieve 22,784
PowerShellThis post is part of the series on PowerShell Snippets.

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.

Read original post PowerShell Snippets: Prompt User for Password at azurecurve|Ramblings of an IT Professional


This was originally posted here.

Comments

*This post is locked for comments