https://www.pdq.com/blog/secure-password-with-powershell-encrypting-credentials-part-1/ https://blogs.technet.microsoft.com/heyscriptingguy/2013/03/26/decrypt-powershell-secure-string-password/ https://blogs.technet.microsoft.com/robcost/2008/05/01/powershell-tip-storing-and-using-password-credentials/
Last active
April 27, 2018 17:34
-
-
Save Dapacruz/d03463a1a4e1429263235fdf6bd92887 to your computer and use it in GitHub Desktop.
Save an encrypted password to a file and retrieve it later for use in a PowerShell script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Save an encrypted password to a file and retrieve it later for use in a script | |
Read-Host -AsSecureString | ConvertFrom-SecureString | Out-File password.txt | |
$user = 'user' | |
$password = Get-Content password.txt | ConvertTo-SecureString | |
$creds = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $user, $password |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment