![]() $encryptedPassword = Import-Clixml -Path 'C:\Reports\encrypted.xml' Get-Credential | Export-Clixml -Path 'C:\Reports\encrypted.xml'Īfter the password has been stored as an encrypted string, the following extracts that password and uses it to login: ![]() I ran this once to create the XML file with the encrypted password string, and this is not part of the mail script. However when I run it as Scheduled Task or if I simply right click and run in PowerShell, it fails. So I tried the following to store the credentials as a secret key, and it works like a charm when I run PowerShell as administrator under my own account.
0 Comments
Leave a Reply. |