Hi All,
Working on an Audit script run from the audit server that uses a generic account with Read Only access to all vCenters. I would like to use the VICredentialStoreItem to store the credentials and have the script pull the credentials rather than sharing the credentials with those that would use the script.
I have tried this but no luck.
$vCenter = 'vc1','vc1'
$vCenterUser = 'ReadOnlyAccount'
foreach ($vC in $vCenter) {
if (Test-Connection $vC -Count 2 -Quiet) {
Connect-VIServer -Server $vC -Credential (Get-VICredentialStoreItem -Host $VC -User $vCenterUser -File 'C:\creds.xml')
}
else {}