PowerCLI- Credential Store feature.
When creating scripts using PowerCLI you don’t want to have to enter your username and password every time you run the script to connect to your VIServer. Instead a lot of people add their credentials to their scripts, which is in plain text. Stop doing this!!!! PowerCLI has a feature called Credential Store it creates an XML file in %APPDATA%\VMware\credstore\vicredentials.xml by default and obscures the password.
So how do you do it?
Open PowerShell CLI
- New-VICredentialStoreItem –Host vcenter name –User username –Password password
If you would like to specify where to store the vicredential.xml file add –File path to the end and name the xml file whatever you would like
- New-VICredentialStoreItem –Host myvcenter –User sally –Password exc3ll3nt
Or to store in the non-default location
- New-VICredentialStoreItem –Host myvcenter –User sally –Password exc3ll3nt –File c:\cred\vmcreds.xml