Unable to connect to ESXi or vCenter server using PowerCLI using 'Connect-VIServer'
search cancel

Unable to connect to ESXi or vCenter server using PowerCLI using 'Connect-VIServer'

book

Article ID: 386750

calendar_today

Updated On:

Products

VMware vSphere ESXi VMware vCenter Server

Issue/Introduction

Connect to ESXi or vCenter server using PowerCLI command Connect-VIServer fails with below error message

PS C:\WINDOWS\system32> Connect-VIServer -Server <vCenter Server or Host IP/FQDN>
Connect-VIServer : MM/DD/YYYY HH:MM:SS Connect-VIServer                Could not resolve the requested VC server.
Additional Information: There was no endpoint listening at https://<vCenter Server IP/FQDN>/sdk that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
At line:1 char:1
+ Connect-VIServer -Server <vCenter Server IP/FQDN>
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (:) [Connect-VIServer], ViServerConnectionException
    + FullyQualifiedErrorId : Client20_ConnectivityServiceImpl_Reconnect_NameResolutionFailure,VMware.VimAutomation.ViCore.Cmdlets.Commands.ConnectVIServer

Cause

Assuming the correct IP address is being used to connect to the vCenter Server or ESXi host, this is likely due to one, or two different issues.

First check if there is an allowed IP address configured for the firewall rule. 

(1) To investigate this, login in to ESXi host client.
Click Networking in the VMware Host Client inventory.
Click Firewall rules tab.
The VMware Host Client displays a list of active incoming and outgoing connections with the corresponding firewall ports.

The Firewall Settings screen will look similar to this below, and will show which setting you have selected, and which IP addresses or network are allowed if it is configured. 

(2) For vCenter Server: Login-in to vCenter Server Appliance Management Interface (VAMI), under Firewall validate the Firewall settings.

Secondly, check if port 443 is blocked from your workstation to the server you are connecting to. You can test this with the following PowerShell command (replace 0.0.0.0 with the IP address of your server):

Test-NetConnection -ComputerName <vCenter Server IP/FQDN> -Port 443

The output should look similar to below:

ComputerName     : ##.##.#.# 
RemoteAddress    : ##.##.#.# 
RemotePort       : 443
InterfaceAlias   : Ethernet 5
SourceAddress    : ##.##.#.#
TcpTestSucceeded : True(1)

Resolution

If the firewall rule is configured to only allow connections from specific IP addresses or networks, that will need to be adjusted. Alternatively, it can be set to allow all connections from all IP addresses.

If the test on port 443 is not successful, consultation with the network team is needed to determine if a firewall or other network device is blocking the connection.