PowerCLI’s “Credential Store”

 

 

If you are logged in to your computer with a domain account, you can use your Windows session credentials to connect to a vCenter or ESXi server. If you are not logged in to your computer with a domain account or your domain account has no rights in vSphere, you have to supply account information every time you connect to a vCenter or ESXi server.

To prevent you from having to do this, you can store credentials in the credential store. These stored credentials will be used as default if you connect to a server that is stored in the credential store. You can use the New-VICredentialStoreItem  parameter of the Connect-VIServer cmdlet to indicate that you want to save the specified credentials in the local credential store, as follows:

 

Simple command to store credentials
PowerCLI C:\> New-VICredentialStoreItem -Host 192.168.10.10 -User “My_Login” -Password “my_password”

 

Listing of all of your stored credentials
PowerCLI C:\> Get-VICredentialStoreItem

 

Simple command to remove store credentials
PowerCLI C:\> Remove-VICredentialStoreItem -Host 192.168.10.10 -User “My_Login” -Password “my_password”

 

How to see contents of the default credential store file.
PowerCLI C:\> Get-Content -Path $env:APPDATA\VMware\credstore\vicredentials.xml