We're using PowerShell with the iControl cmdlets in order to build a script that will automatically put servers into and out of rotation before and after software deployments. We would like to avoid having a plaintext password in the script file - what approaches have others used to make this happen?
In addition to the Username and Password parameters, there's alternatively the PSCredentials argument that can in a PowerShell PSCredentials object (generated by the Get-Credential cmdlet). But to generate that, you still need the password.
I've seen customers do several things. First, if this script is interactive (meaning it's not run as part of an automated process), you can add the username/password as input parameters to your script and the person running it will have to supply them.
Second, you could store them in a database somewhere and build a process to retrieve them in the script with whatever interface you define.
No easy solution as you ultimately need the password to be able to authenticate.