Categories
Sponsors
Archive
Blogroll
Badges
Community
|
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 |
$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 |
$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)
Leave a Reply
|