Tuesday, December 2, 2014

Get user password via powershell credential windows

I needed a simple way of getting someone windows credential, I want publish the full flow but the main core is the 4 line powershell script that initiate windows credential dialog containning bith domain and user name after user type the password and press "OK" we use the built in powershell "ConvertFrom-SecureString" to uncover is password.

$user = whoami
$ClearPassword = Get-Credential -Credential $user
$ClearPassword.Password | ConvertFrom-SecureString
$ClearPassword.GetNetworkCredential().password

No comments:

Post a Comment