Isolation represents one of the fundamental features of a hypervisor. If we didn’t want isolation, we would have little need to virtualize anything. We could install one operating system on a host and add software until we ran out of capacity. Security and compatibility prevent that approach. However, too much isolation causes other problems. Microsoft supplies the Hyper-V Guest Services as one solution.
Update 10/1/2017: Thanks to Chuck Timon, a Senior Premier Field Engineer (PFE) at Microsoft, for numerous suggestions!
The Isolation Model
Visually, Hyper-V’s isolation model looks something like this:
The management operating system loads the hardware drivers that Hyper-V utilizes, but otherwise, stays separated. Hyper-V keeps the management operating system and virtual machines “partitioned” from itself and each other. Of course, 100% isolation is neither possible nor practical. So, Hyper-V provides several interfaces for the virtual machines to use. VMBus manages most of these interfaces. As a “bus”, it carries requests and responses between Hyper-V and the guests.
The available interfaces in Hyper-V 2016 (that I know of):
- Emulated and synthetic hardware, SR-IOV, and Discrete Device Access
- Automatic virtual machine activation (Datacenter Edition only)
- PowerShell Direct
- Service monitoring (Failover Clustering only)
- Integration services
- Operating system shutdown
- Time synchronization
- Data Exchange
- Backup (volume shadow copy)
- Guest services
- Virtual Trusted Platform Module (vTPM)
- Hyper-V Sockets
This article focuses on the integration services.
An Overview of the Integration Services
Each integration service provides a specific function to the virtual machine. For most, you can figure out its function just by looking at its name. The functions are projected into each virtual machine, but a matching software construct must exist and be enabled within the guest operating system.
For Windows guests, Microsoft provides a set of standard Windows services.
- Hyper-V Data Exchange Service: aligns with Data Exchange
- Hyper-V Guest Service Interface: aligns with Guest services
- Hyper-V Guest Shutdown Service: aligns with Operating system shutdown
- Hyper-V Time Synchronization Service: aligns with Time synchronization
- Hyper-V Volume Shadow Copy Requestor: aligns with Backup (volume shadow copy)
Microsoft has distributed these as core components of its operating systems since Windows Vista/Windows Server 2008. Up through Windows Server and Hyper-V Server 2012 R2, every server maintained a local copy of the integration services and conveniently packaged them as vmguest.iso at each reboot. You can find the files in the host’s “\Windows\vmguest” folder and the packaged ISO in “\Windows\System32”.
Starting with Windows 10/Windows Server 2016, these files no longer exist on the host.
Windows Services that are Not Part of the Hyper-V Integration Services
You may see additional services that include Hyper-V or something that implies Hyper-V. Other than the ones that I listed, none are part of the official Hyper-V 2016 Integration Services stack that we’re talking about in this article.
- HV Host Service: Rather than re-invent the wheel, I’ll just paste the perfectly adequate description text right from the service: “Provides an interface for the Hyper-V hypervisor to provide per-partition performance counters to the host operating system.”
- Hyper-V Host Compute Service: You will find this service on Hyper-V 2016 hosts, including Windows 10 and nested Hyper-V instances. It provides an API for container systems.
- Hyper-V Remote Desktop Virtualization Service: I have no idea what this service does. It’s always running on my 2016 guests but not on my 2012 R2 guests. My first thought was that it enables Enhanced Session Mode from within the guest. So I stopped it. I had no trouble using Enhanced Session mode after that. It may be for RemoteFx.
- Hyper-V Virtual Machine Management: This is the familiar VMMS that has been with us since the beginning. In previous versions, it was just called “Virtual Machine Management”. It runs on all Hyper-V hosts and enables VM control functionality (start, stop, etc.).
Integration Services Version Compatibility
Even though the host-side projections exist within every virtual machine that it creates, not every guest operating system has access to the matching client-side service. As an example, the Hyper-V Guest Service Interface cannot be installed into any guest prior to Windows 8.1/Windows Server 2012 R2. Therefore, that service will not be available on earlier operating systems.
Also, the host’s version rules over all guests. If you install a later version on a guest and then move it to an older host, you might have some difficulties.
Installing/Updating Hyper-V Guest Services on Windows
As previously mentioned, all currently supported versions of Windows and Windows Server ship with the guest services already installed. The process for updating them has changed since its inception, however.
For Windows XP/Windows Server 2003 up through Windows 8.1/Windows Server 2012 R2 while running on any Hyper-V host version from 2008 through 2012 R2, you would install/update by inserting the host’s vmguest.iso in the guest. The Hyper-V Virtual Machine connect window included an action:
Any time that Microsoft released an update for the integration services via Windows Update, only the host would be automatically updated. The guests could only be updated via a manual process. You could use the action shown above, manually insert the vmguest.iso, or even manually transfer the install files into the guest.
Now, the client packages for the integration services are also delivered via Windows Update. Simply keep your guests up-to-date and you will no longer need to worry about this.
Note 1: Windows Update will deliver integration services updates to Windows guests as far back as Vista, Windows Server guests as far back as 2008 R2. Some other guest operating systems will also have some support; see the Keep integration services up to date section on the official TechNet page.
Note 2: For older operating systems, remember that the host version rules. Meaning, do not attempt to install the files from a 2012 R2 host into a guest running on Hyper-V Server 2008.
Note 3: You’ll face some challenges for unsupported legacy operating systems such as Windows XP. You’ll need to find the newest versions that will still install by trying each of the server versions in turn. Do not expect perfect results.
Installing/Updating Hyper-V Guest Services on Linux
The core Hyper-V guest services have been natively built into the Linux kernel for quite some time. If you use a recent, mainstream distribution, then you’ve already got most of the services. They will automatically be updated anytime you update or upgrade your kernel.
If you wish to update the components separately or on a system with an older kernel, Microsoft makes the Linux Integration Services available for download. As of this writing, the current release version is 4.2. The lis-next GitHub project provides the source for feature backports to older versions. You can watch Microsoft’s official virtualization blog for notifications about new versions.
Not all features are included by default with the kernel-embedded integration services, notably Data Exchange and file copy (the only part of Guest services that Linux supports). Start on Microsoft’s official Linux on Hyper-V page. On the left or at the link list at the bottom, find your distribution’s page. Follow the directions to enable the additional features on your distribution.
Details on the Hyper-V Integration Services
Each service provides specific functionality, described below.
The Hyper-V Operating System Shutdown Service
Hyper-V’s Operating System Shutdown Service communicates with the matching service in the guest operating system to gracefully shut down the guest operating system. Without it, you can only force stop the virtual machine from Hyper-V.
The Hyper-V Time Synchronization Service
Hyper-V’s Time Synchronization Service keeps the guest’s time inline with the host’s. It respects any time zone differences. Do not use it for virtualized domain controllers, especially one that holds the PDC emulator role. Otherwise, it’s generally a good idea to leave it enabled for all guests.
The Hyper-V Data Exchange Service
Hyper-V uses key-value pairs to transmit unformatted information between the guest and the host. On Windows guests, the service operates through the guest’s registry. On Linux, the service operates through specially formatted files. On the host side, the Hyper-V WMI API facilitates key exchange for all guests. I have an article series that explains all of this and provides some plumbing to make it easy to use.
The Hyper-V Heartbeat Service
Due to isolation, the hypervisor can only directly sense if a virtual machine is in a powered on state. Beyond that, whatever happens inside the VM stays inside the VM. The heartbeat service is a simple sort of up/down tool. If the service can respond to the hypervisor, then the guest operating system is running at least well enough to start services. There may be some more detailed checks included, but that’s the basic summary of this service.
If the virtual machine lives on a cluster of Hyper-V hosts and has been set to High Availability mode, then failover clustering will extend the heartbeat service’s functionality. Locate the cluster’s virtual machine object and access its Properties. Look at the bottom of the Settings tab:
The Hyper-V Backup (volume shadow copy) Service
The volume shadow copy service (usually known as VSS) is a mechanism that Windows uses to facilitate crash- and application-consistent backups without stopping a computer. It functions by quiescing I/O and notifying applications that a backup will be occurring. Virtual machines present a problem if you want to back them up from the host. Even though Hyper-V can pause processing for a virtual machine, it can’t directly quiesce the guest operating system. So, its backup integration service operates as an intermediary.
When backup begins on the host, it can use this integration service to notify the VSS service within the guest. On Linux, the integration services uses a similar mechanism, although it can only quiesce I/O.
In older versions of Hyper-V, virtual machine backup used the standard VSS mechanism in the host. In modern versions, it relies on Hyper-V’s checkpointing mechanism instead. However, in-guest operations are still controlled by VSS.
Hyper-V Guest Services
I really wish that Microsoft had come up with a better name than just Guest services. Without context, it’s tough to realize that this is not a synonym for the overall category of Hyper-V integration services. The Guest services Hyper-V service allows you to copy files directly between the host and the guest. Be aware that the PowerShell Copy-VMFile works without further restrictions if you enable the service, but you must also enable Enhanced Session for the virtual machine if you want to use drag/drop functionality.
How to Manipulate Integration Services in PowerShell
You should not manipulate services from within the guest. Use PowerShell or the GUI at the Hyper-V level. It will automatically handle service status within the guest.
Be aware that you can’t force a feature to work if the guest’s integration services don’t support it. For instance, you can’t enable the Guest Service for a Windows 2008 R2 guest and then copy a file into it.
Retrieve Integration Services in PowerShell
To see the guest services and their statuses for a virtual machine, use Get-VMIntegrationService.
Ex: Get-VMIntegrationService -VMName svdc1
From the output, you can see if a service is enabled and, if it is, its current status. Note that disabled services will always show a primary status of OK. This particular VM shows a nice example for secondary statuses as well. For the Heartbeat service, you can see that its monitored indicators are all OK. For VSS, it wants to tell us something about the component version, but we can’t read it all here.
To expand a secondary status description, specify the Name of the integration service to check, enclose the whole thing in parenthesis, and use the dot selector to pick the SecondaryStatusDescription property. Ex: (Get-VMIntegrationService -VMName svdc1 -Name 'VSS').SecondaryStatusDescription.
Basically, the integration service is out of date, so I might have problems backing this one up.
Enable Integration Services in PowerShell
Enable an integration service with Enable-VMIntegrationService.
Ex: Enable-VMIntegrationService -VMName svdc1 -Name 'Guest Service Interface'.
It will help if you run Get-VMIntegrationService first so that you can copy/paste the name. You can also use the pipeline to send objects from Get-VMIntegrationService to Enable-VMIntegrationService.
Disable Integration Services in PowerShell
Disable an integration service with Disable-VMIntegrationService.
Ex: Disable-VMIntegrationService -VMName svdc1 -Name 'Guest Service Interface'.
It will help if you run Get-VMIntegrationService first so that you can copy/paste the name. You can also use the pipeline to send objects from Get-VMIntegrationService to Disable-VMIntegrationService.
How to Manipulate Integration Services in Hyper-V Manager
In Hyper-V Manager, you can determine if any given service is enabled. It will show the status of the Heartbeat service, but no others. Failover Cluster Manager uses the same dialog to show enabled/disabled state for services but does not show status for any of them.
On the virtual machine’s Settings dialog, look on the Integration Services tab. A service is enabled if it is checked. Be aware that checking a box for a service that the client does not support has no effect. For instance, you can check the Guest service box for a 2008 R2 guest, but you will not be able to copy files to/from it.
To check the Heartbeat status, highlight the VM in Hyper-V Manager’s Virtual Machines pane. In the lower section, ensure that you are on the Summary tab. Look for the Heartbeat field:
Leveraging Integration Services in Automation
I think that you can easily determine uses for these services, so I won’t throw a lot of silly ideas at you.
I would recommend that you find a way to incorporate regular checks of the Heartbeat service into your monitoring system. If the secondary status doesn’t return OK, there’s a solid chance that the virtual machine has crashed.
Look around a bit, and you might find other uses.