Created
February 7, 2015 04:02
-
-
Save BrendanThompson/3c71a8a69403c3ad8053 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Store PSCredential as SecureString | |
New-Variable -Name "myPassword" -Value $(Read-Host -AsSecureString | ConvertFrom-SecureString) | |
New-Variable -Name "myUsername" -Value "DOMAIN\Administrator" | |
# Construct PSCredential Object | |
New-Variable -Name "myCredential" -Value $(New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $myUsername, $myPassword) | |
# Now the Variable `myCredential` can be used as a Credential object to be passed around |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment