Last active
March 16, 2021 17:21
-
-
Save AdamZWinter/03c5b4931cac20f3dc94604fcce51f90 to your computer and use it in GitHub Desktop.
Powershell Password Credentials to String
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
#Prompts for the username/password, enter the username in the form of DomainName\UserName | |
$Credential = get-credential -Message "Please enter the VPM credentials" | |
#Converts the password to clear text to pass it through correctly as passing through a secure string does not work. | |
$Password = $credential.GetNetworkCredential().password | |
#Converts the $Credential to just the DomainName/UsernName. | |
$Account = $credential.UserName | |
echo $Password | |
echo $Password.GetType() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment