適用於:Windows 10、windows Server 2016 中,Windows Server 2019Applies To: Windows 10, Windows Server 2016, Windows Server 2019

管理 HYPER-V 整合服務Manage Hyper-V Integration Services

HYPER-V 整合服務增強虛擬機器效能,並提供利用與 HYPER-V 主機的雙向通訊的便利功能。Hyper-V Integration Services enhance virtual machine performance and provide convenience features by leveraging two-way communication with the Hyper-V host. 其中許多服務是一項便利措施,例如客體檔案複製,有些則是重要虛擬機器的功能,例如綜合裝置驅動程式。Many of these services are conveniences, such as guest file copy, while others are important to the virtual machine's functionality, such as synthetic device drivers. 這組服務與驅動程式有時稱為 「 整合元件 」。This set of services and drivers are sometimes referred to as "integration components". 您可以控制個別方便服務運作為任何指定的虛擬機器。You can control whether or not individual convenience services operate for any given virtual machine. 驅動程式元件不打算以手動方式提供服務。The driver components are not intended to be serviced manually.

如需每個整合服務的詳細資訊,請參閱HYPER-V Integration ServicesFor details about each integration service, see Hyper-V Integration Services.

重要

您想要使用每個的服務必須能夠在主機和客體中才能運作。Each service you want to use must be enabled in both the host and guest in order to function. Windows 客體作業系統預設會開啟 「 HYPER-V 客體服務介面 」 以外的所有整合服務。All integration services except "Hyper-V Guest Service Interface" are on by default on Windows guest operating systems. 服務可以開啟或關閉個別。The services can be turned on and off individually. 下一節中將會告訴您作法。The next sections show you how.

開啟或關閉使用 HYPER-V 管理員的整合服務Turn an integration service on or off using Hyper-V Manager

  1. 從中間窗格中,以滑鼠右鍵按一下 虛擬機器,然後按一下設定From the center pane, right-click the virtual machine and click Settings.

  2. 從左窗格設定] 視窗底下管理,按一下 [ Integration ServicesFrom the left pane of the Settings window, under Management, click Integration Services.

[Integration Services] 窗格會列出所有可用 HYPER-V 主機上的 integration services 和主機是否已啟用虛擬機器,以使用它們。The Integration Services pane lists all integration services available on the Hyper-V host, and whether the host has enabled the virtual machine to use them.

開啟或關閉使用 PowerShell 的整合服務Turn an integration service on or off using PowerShell

若要在 PowerShell 中這麼做,請使用Enable-vmintegrationserviceDisable-vmintegrationserviceTo do this in PowerShell, use Enable-VMIntegrationService and Disable-VMIntegrationService.

下列範例會示範開啟客體檔案複製整合服務開啟和關閉虛擬機器名為"demovm"。The following examples demonstrate turning the guest file copy integration service on and off for a virtual machine named "demovm".

  1. 取得一份執行 integration services:Get a list of running integration services:

    Get-VMIntegrationService -VMName "DemoVM"
    
  2. 輸出應該看起來像這樣:The output should look like this:

    VMName      Name                    Enabled PrimaryStatusDescription SecondaryStatusDescription
    ------      ----                    ------- ------------------------ --------------------------
    DemoVM      Guest Service Interface False   OK
    DemoVM      Heartbeat               True    OK                       OK
    DemoVM      Key-Value Pair Exchange True    OK
    DemoVM      Shutdown                True    OK
    DemoVM      Time Synchronization    True    OK
    DemoVM      VSS                     True    OK
    
  3. 開啟 客體服務介面:Turn on Guest Service Interface:

    Enable-VMIntegrationService -VMName "DemoVM" -Name "Guest Service Interface"
    
  4. 確認已啟用 客體服務介面:Verify that Guest Service Interface is enabled:

    Get-VMIntegrationService -VMName "DemoVM" 
    
  5. 關閉客體服務介面:Turn off Guest Service Interface:

    Disable-VMIntegrationService -VMName "DemoVM" -Name "Guest Service Interface"
    

正在檢查客體的整合服務版本Checking the guest's integration services version

某些功能可能無法運作正確,或完全,如果不是目前的客體整合服務。Some features may not work correctly or at all if the guest's integration services are not current. 若要取得的版本資訊的 Windows 登入客體作業系統中,開啟命令提示字元中,並執行此命令:To get the version information for a Windows, log on to the guest operating system, open a command prompt, and run this command:

REG QUERY "HKLM\Software\Microsoft\Virtual Machine\Auto" /v IntegrationServicesVersion

舊版客體作業系統不會有所有可用的服務。Earlier guest operating systems will not have all available services. 比方說,Windows Server 2008 R2 客體不能有 「 HYPER-V 客體服務介面 」。For example, Windows Server 2008 R2 guests cannot have the "Hyper-V Guest Service Interface".

啟動和停止 Windows 客體整合服務Start and stop an integration service from a Windows Guest

為了讓是功能完整的整合服務,其對應的服務必須執行內除了要在主機上啟用來賓。In order for an integration service to be fully functional, its corresponding service must be running within the guest in addition to being enabled on the host. 在 Windows 客體,每個整合服務會列為標準的 Windows 服務。In Windows guests, each integration service is listed as a standard Windows service. 您可以使用 [服務] 小程式,在 [控制台] 或 PowerShell 來停止和啟動這些服務。You can use the Services applet in Control Panel or PowerShell to stop and start these services.

重要

停止的整合服務,可能會嚴重影響主機的能力來管理您的虛擬機器。Stopping an integration service may severely affect the host's ability to manage your virtual machine. 正常運作,則必須啟用主機和客體上的每個您想要使用的整合服務。To work correctly, each integration service you want to use must be enabled on both the host and guest. 最佳做法,您應該只會控制整合服務,從 HYPER-V 使用上述指示。As a best practice, you should only control integration services from Hyper-V using the instructions above. 在客體作業系統中相符的服務將會停止,或自動啟動,當您變更其狀態在 HYPER-V 中。The matching service in the guest operating system will stop or start automatically when you change its status in Hyper-V. 如果您在客體作業系統中啟動服務,但它已停用 HYPER-V 中,服務會停止。If you start a service in the guest operating system but it is disabled in Hyper-V, the service will stop. 如果您停止在 HYPER-V 中啟用客體作業系統中的服務時,HYPER-V 會最後會重新啟動它。If you stop a service in the guest operating system that is enabled in Hyper-V, Hyper-V will eventually start it again. 如果您停用客體中的服務時,HYPER-V 將無法啟動它。If you disable the service in the guest, Hyper-V will be unable to start it.

使用 Windows 服務來啟動或停止在 Windows 客體整合服務Use Windows Services to start or stop an integration service within a Windows guest

  1. 開啟 [服務管理員] 執行services.msc身為系統管理員,或按兩下控制台中的 [服務] 圖示。Open Services manager by running services.msc as an Administrator or by double-clicking the Services icon in Control Panel.

    螢幕擷取畫面顯示 [Windows 服務] 窗格

  2. 尋找開頭為 「 HYPER-V 」 的服務。Find the services that start with "Hyper-V".

  3. 以滑鼠右鍵按一下您想要啟動或停止服務。Right-click the service you want start or stop. 按一下所需的動作。Click the desired action.

使用 Windows PowerShell 來啟動或停止在 Windows 客體整合服務Use Windows PowerShell to start or stop an integration service within a Windows guest

  1. 若要取得一份整合服務,請執行:To get a list of integration services, run:

    Get-Service -Name vm*
    
  2. 輸出看起來應該如下所示:The output should look similar to this:

    Status   Name               DisplayName
    ------   ----               -----------
    Running  vmicguestinterface Hyper-V Guest Service Interface
    Running  vmicheartbeat      Hyper-V Heartbeat Service
    Running  vmickvpexchange    Hyper-V Data Exchange Service
    Running  vmicrdv            Hyper-V Remote Desktop Virtualizati...
    Running  vmicshutdown       Hyper-V Guest Shutdown Service
    Running  vmictimesync       Hyper-V Time Synchronization Service
    Stopped  vmicvmsession      Hyper-V VM Session Service
    Running  vmicvss            Hyper-V Volume Shadow Copy Requestor
    
  3. 執行下列其中一Start-service或是Stop-serviceRun either Start-Service or Stop-Service. 例如,若要關閉 Windows PowerShell Direct,請執行:For example, to turn off Windows PowerShell Direct, run:

    Stop-Service -Name vmicvmsession
    

啟動和停止從 Linux 客體的整合服務Start and stop an integration service from a Linux guest

Linux 整合服務通常是透過 Linux 核心提供。Linux integration services are generally provided through the Linux kernel. 為 Linux 整合服務驅動hv_utilsThe Linux integration services driver is named hv_utils.

  1. 若要找出是否hv_utils載入時,使用下列命令:To find out if hv_utils is loaded, use this command:

    lsmod | grep hv_utils
    
  2. 輸出看起來應該如下所示:The output should look similar to this:

    Module                  Size   Used by
    hv_utils               20480   0
    hv_vmbus               61440   8 hv_balloon,hyperv_keyboard,hv_netvsc,hid_hyperv,hv_utils,hyperv_fb,hv_storvsc
    
  3. 若要找出必要的精靈是否正在執行,使用此命令。To find out if the required daemons are running, use this command.

    ps -ef | grep hv
    
  4. 輸出看起來應該如下所示:The output should look similar to this:

    root       236     2  0 Jul11 ?        00:00:00 [hv_vmbus_con]
    root       237     2  0 Jul11 ?        00:00:00 [hv_vmbus_ctl]
    ...
    root       252     2  0 Jul11 ?        00:00:00 [hv_vmbus_ctl]
    root      1286     1  0 Jul11 ?        00:01:11 /usr/lib/linux-tools/3.13.0-32-generic/hv_kvp_daemon
    root      9333     1  0 Oct12 ?        00:00:00 /usr/lib/linux-tools/3.13.0-32-generic/hv_kvp_daemon
    root      9365     1  0 Oct12 ?        00:00:00 /usr/lib/linux-tools/3.13.0-32-generic/hv_vss_daemon
    scooley  43774 43755  0 21:20 pts/0    00:00:00 grep --color=auto hv          
    
  5. 若要查看可使用哪些精靈,請執行:To see what daemons are available, run:

    compgen -c hv_
    
  6. 輸出看起來應該如下所示:The output should look similar to this:

    hv_vss_daemon
    hv_get_dhcp_info
    hv_get_dns_info
    hv_set_ifconfig
    hv_kvp_daemon
    hv_fcopy_daemon     
    

    下面是可能會列出的整合服務精靈。Integration service daemons that might be listed include the following. 如果遺漏任何,可能不支援您的系統上,或可能不會安裝。If any are missing, they might not be supported on your system or they might not be installed. 找到詳細資訊,請參閱 < 支援的 Linux 和 FreeBSD 虛擬機器,在 Windows 上的 hyper-vFind details, see Supported Linux and FreeBSD virtual machines for Hyper-V on Windows.

    • hv_vss_daemon:若要建立即時 Linux 虛擬機器備份需要此精靈。hv_vss_daemon: This daemon is required to create live Linux virtual machine backups.
    • hv_kvp_daemon:此精靈可用於設定及查詢內建與外來的機碼值組。hv_kvp_daemon: This daemon allows setting and querying intrinsic and extrinsic key value pairs.
    • hv_fcopy_daemon:此精靈可實作檔案,複製在主機與客體之間的服務。hv_fcopy_daemon: This daemon implements a file copying service between the host and guest.

範例Examples

這些範例示範如何停止和啟動 KVP 精靈中,名為hv_kvp_daemonThese examples demonstrate stopping and starting the KVP daemon, named hv_kvp_daemon.

  1. 使用的處理序識別碼(PID)停止精靈的程序。Use the process ID (PID) to stop the daemon's process. 若要尋找的 PID,看看第二個資料行的輸出,或使用pidofTo find the PID, look at the second column of the output, or use pidof. HYPER-V 精靈會執行為根,因此您需要根權限的範圍。Hyper-V daemons run as root, so you'll need root permissions.

    sudo kill -15 `pidof hv_kvp_daemon`
    
  2. 若要確認所有hv_kvp_daemon程序都會消失,執行:To verify that all hv_kvp_daemon process are gone, run:

    ps -ef | hv
    
  3. 若要再次啟動精靈,請以 root 身分執行精靈:To start the daemon again, run the daemon as root:

    sudo hv_kvp_daemon
    
  4. 若要確認hv_kvp_daemon程序會列出新的處理序識別碼,執行:To verify that the hv_kvp_daemon process is listed with a new process ID, run:

    ps -ef | hv
    

將 integration services 保持在最新狀態Keep integration services up to date

我們建議您保留 integration services 以取得最佳的效能和最新的功能,您的虛擬機器的最新狀態。We recommend that you keep integration services up to date to get the best performance and most recent features for your virtual machines. 發生這種情況的大部分的 Windows 客體預設如果它們設定為從 Windows Update 取得重要的更新。This happens for most Windows guests by default if they are set up to get important updates from Windows Update. 當您更新核心時,使用目前的核心的 Linux 客體將會收到最新的整合元件。Linux guests using current kernels will receive the latest integration components when you update the kernel.

在 Windows 10 主機上執行的虛擬機器:For virtual machines running on Windows 10 hosts:

注意

因為不再需要時,不隨附在 Windows 10 上的 HYPER-V 映像檔案 vmguest.iso。The image file vmguest.iso isn't included with Hyper-V on Windows 10 because it's no longer needed.

GuestGuest 更新機制Update mechanism 附註Notes
Windows 10Windows 10 Windows UpdateWindows Update
Windows 8.1Windows 8.1 Windows UpdateWindows Update
Windows 8Windows 8 Windows UpdateWindows Update 需要資料交換整合服務。*Requires the Data Exchange integration service.*
Windows 7Windows 7 Windows UpdateWindows Update 需要資料交換整合服務。*Requires the Data Exchange integration service.*
Windows Vista (SP 2)Windows Vista (SP 2) Windows UpdateWindows Update 需要資料交換整合服務。*Requires the Data Exchange integration service.*
-
Windows Server 2016Windows Server 2016 Windows UpdateWindows Update
Windows Server 半年通道Windows Server, Semi-Annual Channel Windows UpdateWindows Update
Windows Server 2012 R2Windows Server 2012 R2 Windows UpdateWindows Update
Windows Server 2012Windows Server 2012 Windows UpdateWindows Update 需要資料交換整合服務。*Requires the Data Exchange integration service.*
Windows Server 2008 R2 (SP 1)Windows Server 2008 R2 (SP 1) Windows UpdateWindows Update 需要資料交換整合服務。*Requires the Data Exchange integration service.*
Windows Server 2008 (SP 2)Windows Server 2008 (SP 2) Windows UpdateWindows Update 延伸支援僅限於 Windows Server 2016 (閱讀更多)。Extended support only in Windows Server 2016 (read more).
Windows Home Server 2011Windows Home Server 2011 Windows UpdateWindows Update 不支援在 Windows Server 2016 (閱讀更多)。Will not be supported in Windows Server 2016 (read more).
Windows Small Business Server 2011Windows Small Business Server 2011 Windows UpdateWindows Update 不包含在主要支援中 (閱讀更多)。Not under mainstream support (read more).
-
Linux 客體Linux guests 封裝管理員package manager 適用於 Linux 的整合服務會內建在 distro,但可能有選用的更新可用。Integration services for Linux are built into the distro but there may be optional updates available. ********

* 如果無法啟用資料交換整合服務,取得這些客體整合服務都是從下載中心為封包 (cab) 檔案。* If the Data Exchange integration service can't be enabled, the integration services for these guests are available from the Download Center as a cabinet (cab) file. 在此有套用 cab 的指示部落格文章Instructions for applying a cab are available in this blog post.

在 Windows 8.1 主機上執行虛擬機器:For virtual machines running on Windows 8.1 hosts:

GuestGuest 更新機制Update mechanism 附註Notes
Windows 10Windows 10 Windows UpdateWindows Update
Windows 8.1Windows 8.1 Windows UpdateWindows Update
Windows 8Windows 8 整合服務光碟Integration Services disk 請參閱指示底下。See instructions, below.
Windows 7Windows 7 整合服務光碟Integration Services disk 請參閱指示底下。See instructions, below.
Windows Vista (SP 2)Windows Vista (SP 2) 整合服務光碟Integration Services disk 請參閱指示底下。See instructions, below.
Windows XP (SP 2、SP 3)Windows XP (SP 2, SP 3) 整合服務光碟Integration Services disk 請參閱指示底下。See instructions, below.
-
Windows Server 2016Windows Server 2016 Windows UpdateWindows Update
Windows Server 半年通道Windows Server, Semi-Annual Channel Windows UpdateWindows Update
Windows Server 2012 R2Windows Server 2012 R2 Windows UpdateWindows Update
Windows Server 2012Windows Server 2012 整合服務光碟Integration Services disk 請參閱指示底下。See instructions, below.
Windows Server 2008 R2Windows Server 2008 R2 整合服務光碟Integration Services disk 請參閱指示底下。See instructions, below.
Windows Server 2008 (SP 2)Windows Server 2008 (SP 2) 整合服務光碟Integration Services disk 請參閱指示底下。See instructions, below.
Windows Home Server 2011Windows Home Server 2011 整合服務光碟Integration Services disk 請參閱指示底下。See instructions, below.
Windows Small Business Server 2011Windows Small Business Server 2011 整合服務光碟Integration Services disk 請參閱指示底下。See instructions, below.
Windows Server 2003 R2 (SP 2)Windows Server 2003 R2 (SP 2) 整合服務光碟Integration Services disk 請參閱指示底下。See instructions, below.
Windows Server 2003 (SP 2)Windows Server 2003 (SP 2) 整合服務光碟Integration Services disk 請參閱指示底下。See instructions, below.
-
Linux 客體Linux guests 封裝管理員package manager 適用於 Linux 的整合服務會內建在 distro,但可能有選用的更新可用。Integration services for Linux are built into the distro but there may be optional updates available. **

在 Windows 8 主機上執行虛擬機器:For virtual machines running on Windows 8 hosts:

GuestGuest 更新機制Update mechanism 附註Notes
Windows 8.1Windows 8.1 Windows UpdateWindows Update
Windows 8Windows 8 整合服務光碟Integration Services disk 請參閱指示底下。See instructions, below.
Windows 7Windows 7 整合服務光碟Integration Services disk 請參閱指示底下。See instructions, below.
Windows Vista (SP 2)Windows Vista (SP 2) 整合服務光碟Integration Services disk 請參閱指示底下。See instructions, below.
Windows XP (SP 2、SP 3)Windows XP (SP 2, SP 3) 整合服務光碟Integration Services disk 請參閱指示底下。See instructions, below.
-
Windows Server 2012 R2Windows Server 2012 R2 Windows UpdateWindows Update
Windows Server 2012Windows Server 2012 整合服務光碟Integration Services disk 請參閱指示底下。See instructions, below.
Windows Server 2008 R2Windows Server 2008 R2 整合服務光碟Integration Services disk 請參閱指示底下。See instructions, below.
Windows Server 2008 (SP 2)Windows Server 2008 (SP 2) 整合服務光碟Integration Services disk 請參閱指示底下。See instructions, below.
Windows Home Server 2011Windows Home Server 2011 整合服務光碟Integration Services disk 請參閱指示底下。See instructions, below.
Windows Small Business Server 2011Windows Small Business Server 2011 整合服務光碟Integration Services disk 請參閱指示底下。See instructions, below.
Windows Server 2003 R2 (SP 2)Windows Server 2003 R2 (SP 2) 整合服務光碟Integration Services disk 請參閱指示底下。See instructions, below.
Windows Server 2003 (SP 2)Windows Server 2003 (SP 2) 整合服務光碟Integration Services disk 請參閱指示底下。See instructions, below.
-
Linux 客體Linux guests 封裝管理員package manager 適用於 Linux 的整合服務會內建在 distro,但可能有選用的更新可用。Integration services for Linux are built into the distro but there may be optional updates available. **

如需 Linux 客體的更多詳細資訊,請參閱 < 支援的 Linux 和 FreeBSD 虛擬機器,在 Windows 上的 hyper-vFor more details about Linux guests, see Supported Linux and FreeBSD virtual machines for Hyper-V on Windows.

安裝或更新整合服務Install or update integration services

主機早於 Windows Server 2016 和 Windows 10 中,您必須手動安裝或更新客體作業系統的整合服務。For hosts earlier than Windows Server 2016 and Windows 10, you'll need to manually install or update the integration services in the guest operating systems.

  1. 開啟 [Hyper-V 管理員]。Open Hyper-V Manager. 從 工具 功能表的 伺服器管理員中,按一下HYPER-V 管理員From the Tools menu of Server Manager, click Hyper-V Manager.

  2. 連線到虛擬機器。Connect to the virtual machine. 以滑鼠右鍵按一下 虛擬機器,然後按一下 ConnectRight-click the virtual machine and click Connect.

  3. 在 [虛擬機器連線] 的 [執行] 功能表中,按一下 [插入整合服務安裝磁片] 。From the Action menu of Virtual Machine Connection, click Insert Integration Services Setup Disk. 這個動作會載入虛擬 DVD 光碟機中的安裝磁片。This action loads the setup disk in the virtual DVD drive. 視客體作業系統中,您可能需要手動啟動安裝。Depending on the guest operating system, you might need to start the installation manually.

  4. 安裝完成後,即可使用所有的整合服務。After the installation finishes, all integration services are available for use.

這些步驟無法自動完成或在線上的虛擬機器的 Windows PowerShell 工作階段內完成。These steps can't be automated or done within a Windows PowerShell session for online virtual machines. 您可以將它們套用到離線的 VHDX 映像;請參閱此部落格文章You can apply them to offline VHDX images; see this blog post.