Connect-VIServer not working with passed credentials, but works with integrated authentication

StackOverflow https://stackoverflow.com/questions/20623783

  •  02-09-2022
  •  | 
  •  

Question

I ran into a problem today, with a script which used to work correctly. It connects to a vCenter server via PowerCLI, and does some stuff. The problem is that I can no longer connect to the server via script, when I specify the credentials. Neither of the following two commands work:

Connect-VIServer -Server $serverName -Credential $cred

or

Connect-VIServer -Server $serverName -User $userName -Password $password

Both return the message "Cannot complete login due to an incorrect user name or password".

So naturally, I double and triple checked that I didn't have a typo when specifying either of them. I've tried this from multiple systems, using different users, so I suspect that the problem is on the server.

Interestingly, if I start PowerShell as a Windows domain user with permissions for the server, and don't specify anything for credentials, it works fine:

Connect-VIServer -Server $serverName

Has anyone ever run into this, and hopefully have a solution as to why this isn't working?

Was it helpful?

Solution

This looks to be an issue with server authentication, not a PowerCLI issue. The same issue is seen when logging into both the desktop and web clients. These KB articles seem relevant, and I've forwarded them to the sysadmin for the server:

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2043070

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2034798

It turned out to be be a problem with the SSO service.

OTHER TIPS

it looks like vcsa 6.7 still have this similar problem. whatever different users I tried to connect, it has problems with key credential to logon.

Connect-VIServer : 10/9/2019 3:19:44 PM Connect-VIServer Cannot complete login due to an incorrect user name or password.

Instead use below:

$cred = get-credential
Connect-VIServer -Server ServerName -cred $cred
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top