I created a new vi credential store item with "new-vicredentialstoreitem", the cred shows up with get-vicredentialstoreitem, but if I try and connect with connect-viserver -host vicredstorehost, it prompts for creds instead of passing the cred store item through.
You will still need to connect with the Server parameter.
The value you pass on the Server parameter should be the same that you used on the Host parameter with the New-VICredentialStoreItem.
You can build this into a try-catch construct.
try
{
Get-VICredentialStoreItem -Host $vcName -ErrorAction Stop | Out-Null
Connect-VIServer -Server $vcName
}
catch
{
Write-Host "No entry for $vcName found in the credentialstore" -ForegroundColor red
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You will still need to connect with the Server parameter.
The value you pass on the Server parameter should be the same that you used on the Host parameter with the New-VICredentialStoreItem.
You can build this into a try-catch construct.
try
{
Get-VICredentialStoreItem -Host $vcName -ErrorAction Stop | Out-Null
Connect-VIServer -Server $vcName
}
catch
{
Write-Host "No entry for $vcName found in the credentialstore" -ForegroundColor red
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference