Logo

How to Enable Hyper-V on Windows Server 2022

How to Enable Hyper-V on Windows Server 2022

This guide explains how to install and enable the Hyper-V role on a Windows Server 2022 VPS. Hyper-V is Microsoft's built-in hypervisor that allows you to create and manage virtual machines.

How to Enable Hyper-V on Windows Server 2022 VPS

Important Note About VPS and Nested Virtualization

If your Windows Server 2022 is running as a VPS (Virtual Private Server), you'll need nested virtualization support from your hosting provider. Nested virtualization allows you to run Hyper-V inside a virtual machine.

Requirements for nested virtualization:

  • Your VPS provider must support nested virtualization
  • The host server must have it enabled for your VM
  • Contact your provider to confirm support before proceeding

Prerequisites

  • Windows Server 2022 (Standard, Datacenter, or Core)
  • Administrator privileges
  • At least 4 GB of RAM (8 GB or more recommended)
  • 64-bit processor with virtualization extensions (Intel VT-x or AMD-V)
  • Sufficient disk space for virtual machines

Method 1: Install Hyper-V Using Server Manager (GUI)

Step 1: Open Server Manager

  1. Click on the Start menu
  2. Select Server Manager (it usually opens automatically on login)

Step 2: Add Roles and Features

  1. In Server Manager, click Manage in the top right corner
  2. Select Add Roles and Features
  3. Click Next on the Before You Begin page

Step 3: Select Installation Type

  1. Select Role-based or feature-based installation
  2. Click Next

Step 4: Select Server

  1. Select your server from the server pool
  2. Click Next

Step 5: Select Hyper-V Role

  1. In the Roles list, check the box for Hyper-V
  2. A popup will appear asking to add required features
  3. Click Add Features
  4. Click Next

Step 6: Select Features

  1. Review the features list (no additional features required)
  2. Click Next

Step 7: Hyper-V Configuration

  1. Read the Hyper-V information page
  2. Click Next

Step 8: Create Virtual Switches

  1. Select the network adapter(s) you want to use for virtual switches
  2. Click Next

Step 9: Virtual Machine Migration

  1. Configure migration settings if needed (optional)
  2. Click Next

Step 10: Default Stores

  1. Specify default locations for virtual machines and virtual hard disks
  2. Click Next

Step 11: Confirm Installation

  1. Review your selections
  2. Check Restart the destination server automatically if required
  3. Click Install

Step 12: Restart

The server will install Hyper-V and restart automatically. After restart, the installation will complete.

PowerShell provides a faster way to install Hyper-V, especially for servers without a GUI.

Step 1: Open PowerShell as Administrator

  1. Press Windows Key + X
  2. Select Windows PowerShell (Admin) or Terminal (Admin)

Step 2: Install Hyper-V Role

Run the following command:

Install-WindowsFeature -Name Hyper-V -IncludeManagementTools -Restart

Explanation:

  • -Name Hyper-V: Specifies the Hyper-V role
  • -IncludeManagementTools: Installs Hyper-V Manager and PowerShell modules
  • -Restart: Automatically restarts the server after installation

The server will restart automatically after installation completes.

Alternative: Install Without Automatic Restart

If you want to restart manually later:

Install-WindowsFeature -Name Hyper-V -IncludeManagementTools

Then restart when ready:

Restart-Computer -Force

Method 3: Install Hyper-V Using DISM (Command Line)

You can also use DISM (Deployment Image Servicing and Management) from Command Prompt:

DISM /Online /Enable-Feature /All /FeatureName:Microsoft-Hyper-V

Then restart:

shutdown /r /t 0

Verifying Hyper-V Installation

After the server restarts, verify that Hyper-V is installed correctly.

Using PowerShell:

Get-WindowsFeature -Name Hyper-V

Look for Install State: Installed with an X checkbox.

Using Hyper-V Manager:

  1. Press Windows Key + R
  2. Type virtmgmt.msc and press Enter
  3. Hyper-V Manager should open successfully

Special Configuration for VPS (Nested Virtualization)

If your Windows Server 2022 is itself a virtual machine (VPS), your hosting provider must enable nested virtualization. You'll need to contact them to run this command on the host server:

Set-VMProcessor -VMName "YourVMName" -ExposeVirtualizationExtensions $true

Note: You cannot run this command yourself - it must be executed by the hosting provider on their physical host.

Verify Nested Virtualization Support

To check if nested virtualization is enabled, run this in PowerShell on your VPS:

Get-ComputerInfo | Select-Object HyperVRequirementVirtualizationFirmwareEnabled

If it returns True, nested virtualization is supported.

Post-Installation Steps

Create a Virtual Switch

After installing Hyper-V, create a virtual switch for networking:

New-VMSwitch -Name "External Switch" -NetAdapterName "Ethernet" -AllowManagementOS $true

Replace "Ethernet" with your actual network adapter name. To find adapter names:

Get-NetAdapter

Set Default VM Storage Locations

Configure default paths for VMs and virtual hard disks:

Set-VMHost -VirtualHardDiskPath "C:\Hyper-V\Virtual Hard Disks"
Set-VMHost -VirtualMachinePath "C:\Hyper-V\Virtual Machines"

Troubleshooting

Error: "Hyper-V cannot be installed: The processor does not have required virtualization capabilities"

Solution:

  • If on a physical server: Enable virtualization (Intel VT-x or AMD-V) in BIOS/UEFI
  • If on a VPS: Contact your hosting provider to enable nested virtualization

Error: "Hyper-V cannot be installed: A hypervisor is already running"

Solution: This usually means another virtualization software is installed (VMware, VirtualBox). You must uninstall it first.

Hyper-V Manager Won't Open

Solution:

  1. Verify installation: Get-WindowsFeature -Name Hyper-V
  2. Reinstall management tools: Install-WindowsFeature -Name Hyper-V-Tools
  3. Restart the server

Cannot Create Virtual Machines

Solution:

  1. Ensure you have sufficient RAM and disk space
  2. Check that virtualization is enabled in BIOS (physical servers)
  3. Verify nested virtualization is enabled (VPS)

Creating Your First Virtual Machine

After Hyper-V is installed, you can create VMs using:

Hyper-V Manager (GUI):

  1. Open Hyper-V Manager
  2. Right-click your server name
  3. Select New > Virtual Machine
  4. Follow the wizard

PowerShell:

New-VM -Name "TestVM" -MemoryStartupBytes 2GB -NewVHDPath "C:\Hyper-V\TestVM.vhdx" -NewVHDSizeBytes 50GB

Uninstalling Hyper-V

If you need to remove Hyper-V:

Uninstall-WindowsFeature -Name Hyper-V -Restart

Warning: This will remove all virtual machines and their data.

Additional Resources

Summary

To install Hyper-V on Windows Server 2022:

PowerShell (fastest):

Install-WindowsFeature -Name Hyper-V -IncludeManagementTools -Restart

Server Manager: Manage > Add Roles and Features > Select Hyper-V > Install

For VPS users: Contact your hosting provider to enable nested virtualization first.

Join our Discord community server

For any questions, suggestions, or just to chat with the community, join us on Discord!

900+Members