search
Categories
Sponsors
VirtualMetric Hyper-V Monitoring, Hyper-V Reporting
Archive
Blogroll

Badges
MCSE
Community

Cozumpark Bilisim Portali
Secure Password Usage in PowerShell
Posted in Windows Powershell | 1 Comment | 2,465 views | 31/07/2013 16:48

If you need to store a secure password in PowerShell, you can use this process.

First, you should create a hash from your password:

1
2
3
$Key = (3,4,2,3,56,34,254,222,1,1,2,23,42,54,33,233,1,34,2,7,6,5,35,43)
$SecureString = ConvertTo-SecureString "Your_Password" -AsPlainText -Force
$StandardString = ConvertFrom-SecureString $SecureString -Key $Key

After that you can use $StandarString output in your scripts. Just you need to convert it back to secure string:

1
2
$Key = (3,4,2,3,56,34,254,222,1,1,2,23,42,54,33,233,1,34,2,7,6,5,35,43)
$SecureString = ConvertTo-SecureString $StandardString -Key $Key

That’s it. I hope that helps.


Comments (1)

Yusuf Ozturk » Creating new key for PowerShell secure password operations

October 31st, 2014
17:39:08

[…] http://www.yusufozturk.info/windows-powershell/secure-password-usage-in-powershell.html […]



Leave a Reply