So basically I want to write a Powershell script which will export the last 1days worth of Backup Logs for Windows Server Backup, format the info into a nice little table, then SMTP send it to an external location outside of the customers local Exchange. I have a smarthost I can use for this purpose, and the credentials etc.
But I don't want to store the UN and Password in the Powershell in plain text, or have the script running using the credentials in plain text.
Is there a way around this?
Cheers!
I have managed to get around similar problems by taking the password as a secure string and saving it, as an "encrypted standard string" to a file named something like "Account.User.pwd" where Account is the name of the account associated with the password and User is the user who generated the secure string (only this user will be able to decrypt that file).
This is pretty similar to the approach used by @Keith if you follow the link in his comment on the question itself above. The approach below is a little easier to follow as it doesn't play directly with the
[System.Runtime.InteropServices.Marshal]
class.Converting the password back from the contents of the file is more involved, but here is an example that steps through the process:
Thoughts about this approach:
More information:
powershell credentials securestring