Skip to content

Instantly share code, notes, and snippets.

@McShauno
Created September 19, 2017 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save McShauno/a70708c77cef9df06d5703711a2ebeed to your computer and use it in GitHub Desktop.
Save McShauno/a70708c77cef9df06d5703711a2ebeed to your computer and use it in GitHub Desktop.
Reads encrypted credentials from a filename.
function Read-Credential($user, $fileName)
{
$password = Get-Content $fileName | ConvertTo-SecureString
$credential = New-Object System.Management.Automation.PsCredential($user, $password)
$credential
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment