Bored of entering your credentials every time you login to your infrastructure via PowerCLI? Ideally, if you are managing the virtual infrastructure of the same domain as the one you logged in, you should be already able to connect to vCenter and PowerCLI using your logged in credentials. Most of the times this is not the case in multi client support environment.
To create your own xml credential file, use the below command in PowerCLI. Here, ia m going to create a xml for my lab domain vmmaster.local and i am saving the xml file in D: drive as pwd.xml.
New-VICredentialStoreItem -Host vcsa.vmmaster.local -User "vmmaster.local\pkodigan" -Password 'UR_password_Here' -File D:\pwd.xml
Now make use of the saved credentials. Save the below commands as Connect.ps1;change the parameters according to your infrastructure. Save the ps1 file in D drive.
$Credentials = Get-VICredentialStoreItem -Host vcsa.vmmaster.local -File D:\pwd.xml Connect-VIServer vcsa.vmmaster.local -User $Credentials.User -Password $Credentials.Password
Now, the next time you want to login to vCenter using PowerCLI, navigate to the ps1 location and execute it. That’s it! You should now be connected to vCenter without entering your credentials.
Hope this was informative. Thanks!