Vmware PowerCLI is a very powerful tool for managing a Vmware Infrastructure using Powershell. Stopping and starting virtual machines, and a ton of other stuff is available to you as an administrator. It is also quite useful for automation using scripts. However, when using scripts, the credentials you provide to connect to your vSphere or vCenter host is not something that should be exposed in clear text. The solution for this is to use the safe store mechanism that is available and allows you to safely store usernames and passwords and access them later on in your scripts. Basically you store credentials for a specific vSphere or Virtual Center server in an encrypted form where they will remain safe from prying eyes.
The Powershell command to use is the New-VICredentialStoreItem which takes the following parameters, Host, User and Password.
So, to safely store credentials for a host I could enter the following:
New-VICredentialStoreItem -Host virtualcenter.local -User demo -Password P@ssw0rd
Once this is done I could simply connect to my Virtual Center server using the stored credentials as follows: