Hi folks
How to save multiple vcenters credentials in single .xml file and call single vcenter once using that .xml file.
ex:
$vcenterserver="vcenter1","vcenter2","vcenter3","vcenter4"
New-VICredentialStoreItem -Host $vcenterserver -User domain\domainuser -Password 'password' -File "C:\cred.xml"
its fail with below error
after executing as below if i supply host values "vcenter1","vcenter2","vcenter3","vcenter4" then its saving in .xml
New-VICredentialStoreItem -User domain\domainuser -Password 'password' -File "C:\cred.xml"
Hello, vin01-
The issue there is that the -Host parameter only takes a single value. If you pass each vCenter server name to the cmdlet, you should be able to achieve the thing you are intending to do. Like:
## for each server name in $vcenterserver, call New-VICredentialStoreItem
$vcenterserver | Foreach-Object {New-VICredentialStoreItem -Host $_ -User domain\domainuser -Password 'password' -File "C:\cred.xml"}
Then, the file c:\cred.xml should have those four credentials in it. How does that do for you?
Hello, vin01-
The issue there is that the -Host parameter only takes a single value. If you pass each vCenter server name to the cmdlet, you should be able to achieve the thing you are intending to do. Like:
## for each server name in $vcenterserver, call New-VICredentialStoreItem
$vcenterserver | Foreach-Object {New-VICredentialStoreItem -Host $_ -User domain\domainuser -Password 'password' -File "C:\cred.xml"}
Then, the file c:\cred.xml should have those four credentials in it. How does that do for you?
Hello mattboren
This worked perfectly.Thank you