Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
$encryptionKey = (Get-Content "C:\EncryptionKey.txt")
$encryptionKey = [System.Text.Encoding]::Unicode.GetBytes($encryptionKey)
function Get-MyCredential {
$myPassword = Get-PasswordAsSecureString
return new-object System.Management.Automation.PSCredential "My.Username", $domainAdminPassword
function Get-PasswordAsSecureString {
return ConvertTo-SecureString -Key $encryptionKey "Place string representation of encrypted password here"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.