When attempting to connect to a vCenter server using the short name instead of the IP/FQDN of the vCenter server, the vSphere PowerCLI command *Connect-VIServer* fails with the below error, the short name for the same vCenter can be resolved by the machine, but Connect-VIServer is unable to connect to the vCenter.
PowerCLI Command:
$vCenter="shortvCName"
Connect-VIServer -server $vCenter -user $vCenter_user -password $Password -force
Error
Connect-VIServer : yyyy/mm/dd hh:mm:ss Connect-VIServer Failed to resolve requested VC server.
Additional Information:
There was no endpoint listening on https://shortvCName/sdk that could receive the message.
This typically occurs when the address or SOAP action is incorrect. See the InnerException (if there is one) for more information.
vCenter server 7.x
vCenter server 8.x
vSphere PowerCLI
This may be caused by a system proxy being enabled on the machine where the PowerCLI command is being run.
To Resolve the issue, we need to check the following first.
If the proxy is running. disable/bypass proxy for the session before running the Connect-VIServer.
Solution:
Set-PowerCLIConfiguration -Scope Session -ProxyPolicy NoProxy
$vCenter="shortvCName"
Connect-VIServer -server $vCenter -user $vCenter_user -password $Password -force