Friday, November 09, 2007

Reading secure input from PowerShell

This past week at Exchange Connections, I attended a PowerShell session with Devin Ganger. During the session, both Devin (and later myself) tried to remember what the PowerShell cmdlet was to read input from the command line (rather than the Get-Credentials cmdlet).

The cmdlet we were both grappling for was Read-Host. Here is an example of using this cmdlet to set a password variable AND not showing the password on the screen.
$Password = Read-Host "Please enter a password for the users" -AsSecureString

0 Comments:

Post a Comment

<< Home