≡ Menu

How to know the password captured with Get-Credential

I can not right away tell you the use cases of this procedure, but felt interesting. You can know the password entered through Get-Credential cmdlet.

$mycredentials = Get-Credential
[Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($mycredential.Password))

I got this from http://www.roelvanlisdonk.nl/?p=1150

Happy Learning..,
Sitaram Pamarthi