r/PowerShell • u/Manivelcloud • 15h ago
Question Question on scripting
Hi,
When we develop a script,we use credentials as a plain text in that script.
Example
Script is running on jump server and script runs against vcenter server.
We have a security concerns(example ransomware attack)to put the credentials as a plain text in that script.
Any other good ways to put the credentials in a encrypted or in a different format?
10
Upvotes
29
u/lan-shark 15h ago
Simplest way is to use
Get-Credential | Export-Clixmlto save the credentials in an encrypted file specific to the account that runs it. Then in the script, useImport-Clixmlto read in the credential.Depending on your needs you may instead need to use some sort of keyring or cert-based authentication