This article shows how to install Hyper-V in Windows and Windows Server. 請遵循一組符合您需求的指示。
To create and run virtual machines, install the Hyper-V role on Windows Server by using Server Manager, or the Install-WindowsFeature cmdlet in Windows PowerShell.
若要深入瞭解 Hyper-V,請參閱 Hyper-V 技術概觀。 若要試用 Windows Server 2025,您可以下載並安裝評估版。 See the Evaluation Center.
檢查 Windows Server 的系統需求
安裝 Windows Server 或新增 Hyper-V 角色之前,請確定:
您的電腦硬體相容。 如需詳細資訊,請參閱 Windows Server 的系統需求 和 Windows Server 上 Hyper-V 的系統需求。
您不打算使用依賴 Hyper-V 所需相同處理器功能的第三方虛擬化應用程式。 範例包括 VMware 工作站和 VirtualBox。 您可以安裝 Hyper-V 而不卸載這些其他應用程式。 但是,如果您在 Hyper-V 管理程式執行時嘗試使用它們來管理虛擬機,則虛擬機可能無法啟動或無法穩定運行。 如需關閉 Hyper-V Hypervisor 的詳細資訊和指示,如果您需要使用其中一個應用程式,請參閱 虛擬化應用程式無法與 Hyper-V、Device Guard 和 Credential Guard 搭配運作。
如果您想要只安裝管理工具,例如 Hyper-V Manager,請參閱 使用 Hyper-V Manager 遠端管理 Hyper-V 主機。
Install Hyper-V
若要使用 PowerShell 在 Windows Server 上安裝 Hyper-V:
On the Windows desktop, select the Start button and type any part of the name Windows PowerShell.
以滑鼠右鍵按一下 Windows PowerShell,並選取 [以管理員身分執行]。
Important
您必須以系統管理員身分執行 PowerShell,否則命令會失敗。
若要在遠端連線的伺服器上安裝 Hyper-V,請執行下列命令,並以伺服器名稱取代
<computer_name>
。 如果您在本機連線到伺服器,請執行不含-ComputerName <computer_name>
的命令。Install-WindowsFeature -Name Hyper-V -ComputerName <computer_name> -IncludeManagementTools -Restart
安裝隨即啟動。 安裝完成後,計算機就會重新啟動。
伺服器重新啟動後,您可以執行以下命令來確認已安裝的 Hyper-V 角色。
Get-WindowsFeature Hyper-V -ComputerName <computer_name>
如果您在本機連線到伺服器,請執行不含
-ComputerName <computer_name>
的命令。
Note
如果您在執行 Windows Server 的 Server Core 安裝選項的伺服器上安裝此角色,並使用 參數 -IncludeManagementTools
,則只會安裝適用於 Windows PowerShell 的 Hyper-V 模組。 您可以使用另一部計算機上的 GUI 管理工具 Hyper-V Manager,從遠端管理在 Server Core 安裝上執行的 Hyper-V 主機。 如需遠端連線的指示,請參閱 使用 Hyper-V Manager 從遠端管理 Hyper-V 主機。
啟用 Hyper-V 在 Windows 上建立虛擬機。 Hyper-V 可以透過許多方式啟用,包括使用 Windows 控制面板、PowerShell 或使用部署映射處理服務和管理工具 (DISM)。 本文會逐步解說每個選項。
Note
Hyper-V 作為 Windows 的內建選用功能,沒有提供 Hyper-V 的下載。
檢查 Windows 的系統需求
- Windows 10(專業版或企業版),或 Windows 11(專業版或企業版)
- 具有第二層位址轉換的64位處理器(SLAT)。
- VM 監視器模式延伸模組的CPU支援(Intel CPU上的 VT-c)。
- 至少 4 GB 記憶體。
Note
The Hyper-V role can't be installed on Windows 10 Home or Windows 11 Home.
如需詳細資訊和疑難解答,請參閱 Windows Hyper-V 系統需求。
Enable Hyper-V
若要使用PowerShell 在 Windows 上啟用 Hyper-V:
On the Windows desktop, select the Start button and type any part of the name Windows PowerShell.
以滑鼠右鍵按一下 Windows PowerShell,並選取 [以管理員身分執行]。
Important
您必須以系統管理員身分執行 PowerShell,否則命令會失敗。
執行下列命令:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
Enter Y to have the computer restart to complete the installation.
若要使用 DISM 在 Windows 上啟用 Hyper-V 角色:
部署映像服務與管理工具 (DISM) 可協助設定 Windows 和 Windows 映射。 在其許多應用程式中,DISM 可以在作系統執行時啟用 Windows 功能。
On the Windows desktop, select the Start button and type any part of the name Windows PowerShell.
以滑鼠右鍵按一下 Windows PowerShell,並選取 [以管理員身分執行]。
輸入以下命令:
DISM /Online /Enable-Feature /All /FeatureName:Microsoft-Hyper-V
您會看到此功能已啟用,且「作業已順利完成」。
如需 DISM 的詳細資訊,請參閱 DISM 技術參考。