The vSphere PowerCLI *Connect-VIServer* cmdlet might fail if you use the vCenter Server short name instead of the IP/FQDN.
search cancel

The vSphere PowerCLI *Connect-VIServer* cmdlet might fail if you use the vCenter Server short name instead of the IP/FQDN.

book

Article ID: 373826

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

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.

 

Environment

vCenter server 7.x

vCenter server 8.x

vSphere PowerCLI

Cause

This may be caused by a system proxy being enabled on the machine where the PowerCLI command is being run.

Resolution

To Resolve the issue, we need to check the following first.

  • Does the DNS resolve the short name "shortvCName" to a fully-qualified domain name (FQDN)?
  • Does the DNS resolve the FQDN to an IP?
  • Is there a system proxy configured on the machine where the PowerShell process is running?
  • If there is a system proxy setting - is PowerCLI configured to use the system proxy or not? To check this, run Get-PowerCLIConfiguration.
  • Please check if URL https://shortvCName/sdk in the system browser is opening?
  • Check the System Proxy is running.

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