$password = Get-Content C:Passwordspassword.txt | ConvertTo-SecureString -Key (Get-Content C:Passwordsaes.key) $credential = New-Object System.Management.Automation.PsCredential("Luke",$password)