VMware Cloud Community
nicktalbot77
Contributor
Contributor
Jump to solution

Connect-Viserver Prompting For Creds w/ Credential Store Item

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.

Tags (1)
Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

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.

$vcName = 'MyServer'

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

View solution in original post

Reply
0 Kudos
1 Reply
LucD
Leadership
Leadership
Jump to solution

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.

$vcName = 'MyServer'

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

Reply
0 Kudos