Sivaramsharmar
Enthusiast
Enthusiast

Hi Coozybones,

             You can store your Credential in XML file by executing below command for connecting different VC's with out specifying Credentials in plain text file.

New-VICredentialStoreItem -Host "vCenter1" -User "domain\useracnt" -Password "password"

By default your credentials will be stored in encrypted format in XML file in this location(%APPDATA%\VMware\credstore\vicredentials.xml) after executing above command.

If you have special Characters in Password then use single quote.

Change Below Values in Script and try it once.

$vCenterServerName = "vCenter1","vCenter2"

foreach($vcenter in $vCenterServerName){

connect-viserver -server $vcenter

Script Code..................

..............

disconnect-viserver -server $vcenter

}

Replace $vCenterServerName with $vcenter in Script Code.

Reply
0 Kudos