Adding a Hyper-V host to System Center Virtual Machine Manager should be a simple matter. Every once in a while, however, things do, not work the way they should, and the process of adding the host fails. That being the case, I wanted to take the time to walk you through some possible causes. When VMM fails to add a Hyper-V host, the Jobs window will typically display a message similar to the one that is shown in the image below. As you can see, this window displays the error message, an error code, and a brief description of the error.
On the surface, this particular problem would seem to be relatively straightforward. After all, the error number (2940) is a file-transfer error code. Furthermore, the error description specifically tells you that a file transfer has failed and that you should check to make sure that the HTTP service is running and that no firewall rules are blocking HTTP traffic.
Errors can be misleading
Over time, however, I have learned that VMM error messages can be misleading. Unless you take the time to really understand what is going on, you can waste a lot of time chasing the wrong problem. Let me show you what I mean.
The error message shown in the screen capture above seems to imply that HTTP connectivity cannot be established between the Virtual Machine Manager server and the Hyper-V host that is being added. If you examine the Details tab, however, you can see the actual steps that were performed in an effort to add the Hyper-V host to VMM. Step 1.2 involved installing an agent onto the Hyper-V host. This step completed successfully.
In fact, a quick peek at the Hyper-V host’s control panel reveals the presence of the agent that was installed. The Installed On date confirms that this is a new instance of the agent and that the agent isn’t left over from another time. So what is going on?
If we take a closer look at the Jobs window, we can see that the Details pane reveals that the problem occurred while adding the virtual switch extensions to the Hyper-V host. Therefore, this is the area in which we would need to focus our troubleshooting efforts.
Before you delve too far into the troubleshooting process, there are a few things that I recommend doing. First, compare the clock on your Virtual Machine Manager server against the clock on the Hyper-V host that you are having trouble with. Clock skew can cause a variety of problems for Windows Server and Virtual Machine Manager.
Another thing that I would recommend doing is pausing for a few minutes, or possibly even rebooting the Virtual Machine Manager server and the Hyper-V host. Admittedly this advice is so clichéd that it sounds almost laughable. However, there is a method to the madness. Let me explain.
The error message that I showed you in the very first figure in this article is real. I was working on something unrelated and needed to add a Hyper-V host to Virtual Machine Manager. Much to my surprise, the process failed. Since I was going to have to troubleshoot the problem anyway, I decided to write about it. What I didn’t initially realize, however, was that my Hyper-V host was operating at near its peak capacity. The error adding the host didn’t occur because of a configuration problem, but rather because the host was so busy that Virtual Machine Manager timed out before it could finish. After about fifteen minutes, the Hyper-V host showed up in the All Hosts lists in spite of the error message. You can see the host and its virtual machines in the next screen capture.
OK, so obviously this ended up being an easy problem to fix. I just live-migrated a few VMs to a different host as a way of freeing up some resources and then everything started working. But what if the problem had not worked itself out?
In a situation like that, there are three things that I would recommend checking. First, I would check to make sure that nothing was installed on the Hyper-V server that might be interfering with VMM. The parent operating system should not be running anything other than Hyper-V and perhaps a backup agent and an anti-malware application. It is worth noting, however, that anti-malware software can cause problems for Hyper-V if it is not configured specifically for the Hyper-V environment.
The second thing that I would recommend doing is verifying the DNS records for both the Hyper-V host and for the Virtual Machine Manager server. Try performing an nslookup on both the NetBIOS name and on the FQDN and make sure that the correct IP address is being resolved. You can verify the host’s IP address by using the IPConfig command. In the figure below, you can see where I have run IPConfig on the Hyper-V host and nslookup on the Virtual Machine Manager server in an effort to ensure that the DNS records point to the correct IP address. I have run into several situations over the years in which an IP address or a DNS record was inexplicably changed.
The third thing that I recommend checking is the open firewall ports. Given that the error message references HTTP, it stands to reason that ports 80 and 443 will need to be open. However, there may be other ports that need to be open. For example, VMM uses Port 5986 to communicate with the agent on a Hyper-V host. In case you are wondering, this port number is used by WinRM, and so you will also want to check and make sure that the Windows Remote Management (WS-Management) service is running on the Hyper-V host, as shown below.
Main causes for trouble adding Hyper-V host
Over the years, I have seen quite a few examples of Virtual Machine Manager having trouble adding a Hyper-V host. In the vast majority of these situations, the problem was related to either clock skew or to a port being blocked by a firewall. You can find a list of the firewall ports used by VMM here.