Horizon View

VMware Horizon Client Error Couldn’t Connect to Server

Many organizations are making use of VMware Horizon as the solution to enable a successful, effective, and efficient remote work environment. VMware Horizon is able to connect remote workers to VDI environments and even physical machines. With that being said, issues may arise from time to time where your end-users may not be able to connect to the target machine in their desktop pool, whether virtual or physical. Let’s take a look at VMware Horizon Client Error couldn’t connect to server and see some common troubleshooting steps you may need to take to resolve your connectivity issue.

Know your architecture

In order to troubleshoot Horizon effectively, you need to know your architecture in the Horizon environment. How does traffic flow from the outside to your Horizon desktop? Are UAGs in play, Load Balancers, VIPs, multiple Horizon connection servers? Also, what is the state of the agent on the endpoint machine.

Also, just basic troubleshooting methodologies here, but was the target machine working and then stopped? What has changed, anything? Note the architecture of the below diagrams. In the first image, we have a Horizon Client connecting directly to Horizon Connection Servers.

Horizon client connecting directly to Horizon Connection servers
Horizon client connecting directly to Horizon Connection servers

Below, the Horizon Client first connects to the Unified Access Gateway servers which then connect to Horizon Connection Servers and the Horizon Agent Virtual Desktop. One tip here, if you have UAGs in play, you can still test a connection from the Horizon Client directly to the Horizon Connection Server. This connection should be successful. If you can successfully launch a session when directly connected to your Horizon Connection Server from the Horizon Client, you know the issue is somewhere above the Horizon Connection Server – the UAGs, firewall rules, load balancer, VIPs, etc.

Using that trick can help to shortcut troubleshooting to narrow in on where the connectivity issue exists. If you can’t connect to one Horizon Connection server, try the other Connection Server if you have multiples. If you can connect using one and not the other, this narrows in on a potential issue with a particular Connection Server.

Horizon client connecting to UAGs
Horizon client connecting to UAGs

VMware Horizon Client Error Couldn’t Connect to Server

There are a few obvious things to check when users have VMware Horizon Client error couldn’t connect to server. If you have already ruled out the obvious reasons for connectivity issues, such as changing a firewall rule and other clients are connected just fine, you most likely do not have a global issue with the environment. Next, look at the specific Desktop pool > Machines. Note what the status is for the Desktop machine configured for the desktop pool.

If the agent is unreachable, the client will never be able to connect. At that point, you need to figure out why the Horizon Connection server cannot “see” the agent. Is the agent service running? Is the machine down? If the machine exists on a separate network, do you have network level connectivity to the machine in question? Is NAT in play?

Check the status of an agent in the Horizon console
Check the status of an agent in the Horizon console

VMware Horizon Agent physical machines

With physical machines, I have had to implement a registry key in some environments for connecting successfully to remote physical workstations. ***Note***. This has been tested with Horizon 7 only and may not be needed with Horizon 8. However, it is worth trying if you are having weird issues not being able to connect to physical workstations with the Horizon agent installed.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\VMware, Inc.\VMware VDM\Plugins\wsnm\desktop\Params]
"UsePPNotificationsForSessions"="true"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\VMware-RDS] 
"fEnableWinStation"=dword:00000000

Physical machines also do not like to have a user logged into the console and then a connection attempt from Horizon. It will either error or give a message that there are no sessions available.

VMware Horizon Agent Endpoints with NAT translation

The VMware Horizon Agent reports the actual IP address back to the Horizon Connection server that is local to the machine itself. However, what if your connection server does not have a route to that internal network represented by the local IP address? It can cause issues as the Horizon Connection Server attempts to make connection with the private IP reported by the Horizon Agent.

The Horizon Agent reports the discovered IP address of the machine on which it is running to the Connection Server instance. In secure configurations where the Connection Server instance cannot trust the value that Horizon Agent reports, you can override the value provided by Horizon Agent and specify the IP address that the managed machine should be using. If the address of a machine that Horizon Agent reports does not match the defined address, you cannot use Horizon Client to access the machine.

In this case, the vdmadmin command can be a lifesaver. You can use the vdmadmin command with the -A option to override the IP address reported by Horizon Agent. Note the examples given by VMware:

Override the IP address for the machine machine2 in the desktop pool dtpool2.

vdmadmin -A -override -i 10.20.54.165 -d dtpool2 -m machine2

Display the IP addresses that are defined for the machine machine2 in the desktop pool dtpool2.

vdmadmin -A -override -list -d dtpool2 -m machine2

Remove the IP addresses that is defined for the machine machine2 in the desktop pool dtpool2.

vdmadmin -A -override -r -d dtpool2 -m machine2

Remove the IP addresses that are defined for the desktops in the desktop pool dtpool3.

vdmadmin -A -override -r -d dtpool3

VMware Horizon Agent machine with multiple IP addresses

What about a VMware Horizon Agent machine running multiple IP addresses? The Horizon Agent can report the wrong IP to the Horizon Connection Server. There is a special registry key for this case. Note the VMware KB here:

On the virtual machine on which Horizon Agent is installed, open a command prompt, type regedit.exe and create a registry entry to configure the subnet.For example, in an IPv4 network: 

HKLM\Software\VMware, Inc.\VMware VDM\IpPrefix = n.n.n.n/m 

(REG_SZ)In this example, n.n.n.n is the TCP/IP subnet and m is the number of bits in the subnet mask.

Wrapping Up

If you get VMware Horizon Client Error Couldn’t Connect to Server or another similar error, methodical troubleshooting can help to narrow in on where the issue exists. VMware Horizon relies on many different components to the infrastructure that need to be verified. However, there are a few configuration areas as mentioned that can lead to difficulty connecting to the VMware Horizon Agent virtual or physical machine. Hopefully, these few notes can help any struggling with connectivity issues.

Subscribe to VirtualizationHowto via Email 🔔

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Brandon Lee

Brandon Lee is the Senior Writer, Engineer and owner at Virtualizationhowto.com and has over two decades of experience in Information Technology. Having worked for numerous Fortune 500 companies as well as in various industries, Brandon has extensive experience in various IT segments and is a strong advocate for open source technologies. Brandon holds many industry certifications, loves the outdoors and spending time with family.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.