Last updated on July 17, 2023
To install the Hyper-V feature using PowerShell, you can use the Enable-WindowsOptionalFeature
cmdlet.
Here’s an example of how you can accomplish this:
# Install the Hyper-V feature
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
Make sure to run PowerShell with administrative privileges to install the feature. The Enable-WindowsOptionalFeature
cmdlet is used to enable or install Windows optional features, such as Hyper-V, on a Windows operating system.
Executing the above PowerShell command will install the Hyper-V feature on the local machine. The -Online
parameter indicates that the feature is installed on the currently running operating system. The -FeatureName
parameter specifies the name of the feature to install, which in this case is Microsoft-Hyper-V
. The -All
parameter ensures that all sub-features of Hyper-V are installed.
Once the command completes successfully, the Hyper-V feature will be installed on the machine. You can verify the installation by checking for the “Hyper-V Manager” in the Windows Administrative Tools or by running the Get-WindowsOptionalFeature
cmdlet to view the status of installed features.
Please note that the installation process may require a system restart, and the availability of the Hyper-V feature may depend on your Windows version and edition.