Hi
From one central server where some Powershell scripts are running, I would like to connect to multiple vCenter Servers, all not part of the same AD. How can I store passwords in my scripts (or other location) to make scheduled tasks possible that can login, but not reveal the clear text password.
Gabrie
I wouldn't store them in the script itself, but in an external file.
There areseveral possibilities to store credentials (user & password) outside a script.
There is the PowerCLI credential store, see Have you seen PowerCLI’s “Credential Store” feature?
And more general, store the PSCredential in an external file. See for example PowerShell code to store user credentials encrypted for re-use or Powershell: How to encrypt and store credentials securely for use with automation scripts. .
Some functions, build on that 2nd method are available on PoshCode, they are called Export-PSCredential and Import-PSCredential.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I think the easiest way is to store the credentials in the PowerCLI credentials store on the central server, using the New-VICredentialStoreItem cmdlet.
I wouldn't store them in the script itself, but in an external file.
There areseveral possibilities to store credentials (user & password) outside a script.
There is the PowerCLI credential store, see Have you seen PowerCLI’s “Credential Store” feature?
And more general, store the PSCredential in an external file. See for example PowerShell code to store user credentials encrypted for re-use or Powershell: How to encrypt and store credentials securely for use with automation scripts. .
Some functions, build on that 2nd method are available on PoshCode, they are called Export-PSCredential and Import-PSCredential.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you for the replies, I'm going to check this out.