Created
June 12, 2019 10:37
-
-
Save roe3p/046c6caf5e5171a13428a786364b6f56 to your computer and use it in GitHub Desktop.
Check a stored password
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
## This script will retrieve a stored encrypted password to ensure the PS session has been started under the correct | |
## user context. This should only be needed for debugging/testing as the password will be exposed as plaintext | |
## (Note the same account password must be entered before the stored version will be decrypted) | |
## | |
## If the p/w does not come out as expected, try opening the PS session using 'Run as a different user' then | |
## entering the creds of the account the encrypted password belongs to (usually a service acct). Or enter the following: | |
## start powershell_ise -credential "" | |
## | |
"User: " + $env:UserName | |
$SecurePassword = Get-Content c:\PowerShell\encrypted_password2.txt | ConvertTo-SecureString | |
"Password: " + (New-Object PSCredential "user",$SecurePassword).GetNetworkCredential().Password |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment