Introduction
Hyper-V is a built-in Windows hypervisor that allows you to create and manage virtual machines (VMs) without installing third-party software. With it, you can run multiple isolated operating systems on a single computer: test software, explore new OSes, create test environments, or isolate potentially dangerous applications.
This guide provides a detailed explanation of how to create a virtual machine in Hyper-V from scratch, configure its settings, and install a guest operating system. The step-by-step instructions are suitable for Windows 10 and 11 professional editions.
Requirements and Preparation
Before you begin, ensure your system meets the following requirements:
- Operating System: Windows 10/11 Pro, Enterprise, or Education. Home editions do not support Hyper-V.
- Processor: 64-bit processor with virtualization support (Intel VT-x or AMD-V). Enable virtualization in BIOS/UEFI (usually under Advanced → CPU Configuration).
- Memory: Minimum 4 GB, 8 GB or more recommended. Remember that memory is shared between the host and guest system.
- Disk Space: Sufficient free space for virtual hard disks (e.g., 40–60 GB per VM).
- Installation Media: ISO image of the guest OS (Windows, Linux, etc.) or a physical disk.
- Administrator Privileges: Enabling components and configuring Hyper-V requires administrator rights.
💡 Tip: Check if virtualization is enabled by running in PowerShell:
Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V
If the state isDisabled, enable the feature via Control Panel.
Step 1: Enable Hyper-V and Verify Virtualization Support
Hyper-V is disabled by default in Windows. You need to activate it as an operating system component.
- Open Control Panel → Programs → Turn Windows features on or off.
- Find Hyper-V in the list and expand it. Check the boxes:
- Hyper-V
- Hyper-V Management Tools
- Hyper-V Platform
- Click OK and wait for the installation to complete. The system will prompt for a restart—perform it.
After restarting, Hyper-V will be available. For a quick check, open Hyper-V Manager via Windows search (type "Hyper-V").
Step 2: Create a Virtual Switch for Networking
By default, virtual machines are isolated from the network. To provide them with internet and local network access, create an external virtual switch.
- In Hyper-V Manager, select Virtual Switch Manager from the right-hand pane.
- Under Virtual Switches, click Create Virtual Switch.
- Select External as the type and click Create.
- In the External network field, select your physical network adapter (e.g., "Ethernet" or "Wi-Fi").
- Check Allow management operating system to share this network adapter (this is optional but simplifies setup).
- Click OK. The switch will be created, and the host system may temporarily lose network connectivity (it will automatically reconnect).
⚠️ Important: If you have a laptop, an external switch may not work correctly when switching between Wi-Fi and Ethernet. In such cases, consider using an Internal switch and configuring a bridge in the guest OS.
Step 3: Create a New Virtual Machine
Now let's create the actual virtual machine using the wizard.
- In Hyper-V Manager, click New → Virtual Machine in the right-hand pane.
- Before you begin: click Next.
- Specify name and location:
- Name: e.g.,
Windows10-VM. - Location: leave the default or specify another drive with sufficient space.
- Name: e.g.,
- Assign generation:
- Generation 2 (recommended): supports UEFI, faster boot, bootkit protection. Compatible with Windows 8/10/11 and modern Linux.
- Generation 1: for older OSes (Windows 7, older Linux). Only choose if required.
- Assign memory:
- Startup RAM: e.g., 4096 MB (4 GB) for Windows 10.
- Enable Dynamic Memory: can be enabled to allow the VM to use memory as needed (but for performance, allocating a fixed amount is better).
- Configure networking:
- Select the previously created external virtual switch (e.g.,
External Virtual Switch).
- Select the previously created external virtual switch (e.g.,
- Connect virtual hard disk:
- Select Create a virtual hard disk.
- Name and location: leave default or specify your own.
- Size: for Windows 10, minimum 20 GB, but 40–60 GB is recommended. For Linux, 10–20 GB is sufficient.
- Install an operating system:
- Select Install an operating system from a bootable CD/DVD-ROM.
- Under DVD drive, select the ISO file (click Browse and specify the path to your ISO, e.g.,
D:\ISOs\Win10_22H2.iso).
- Click Finish. The virtual machine will appear in the Hyper-V Manager list.
Step 4: Configure Additional VM Settings (Optional)
Before the first boot, you can fine-tune settings for optimal performance.
- In the VM list, right-click the created machine and select Settings.
- Processor:
- Number of virtual processors: 2–4 for Windows 10/11. Do not assign more than physical cores.
- Processor weight: leave default.
- Memory:
- If you didn't use dynamic memory, you can increase Startup RAM (but not more than 80% of physical RAM).
- Security:
- For Windows 10/11 guest OSes, enable Secure Boot only if required (e.g., for Windows Sandbox). Usually not necessary.
- Automatic Start Action: can be configured to start the VM when Hyper-V starts, but for the first time, leave it disabled.
Click OK to save.
Step 5: Boot and Install the Guest Operating System
Now we'll boot from the installation media and install the OS inside the VM.
- In Hyper-V Manager, select the VM and click Start (or right-click → Start).
- After the VM starts, double-click it to open the console window (Virtual Machine Connection).
- In the VM window, press any key to boot from DVD (if it doesn't boot automatically).
- The installation process is standard:
- Select language, keyboard layout, time format.
- Click Install now.
- Enter the product key (if required) or select "I don't have a product key".
- Select the OS edition (e.g., Windows 10 Pro).
- Accept the license agreement.
- Choose installation type: Custom (to remove unnecessary components) or Upgrade.
- Select the disk (virtual) and click Next. Installation will begin and may take 15–30 minutes.
- After reboot, complete the OOBE (Out-of-Box Experience) setup:
- Set up an account (local or Microsoft).
- Set a password.
- Configure privacy settings (can be disabled).
Step 6: Install Hyper-V Integration Services
After installing the guest OS, install the integration components to improve performance and functionality (e.g., dynamic memory management, time synchronization, shared folders).
- In the VM console window, go to the Action menu → Insert Integration Services Setup Disk.
- In the guest OS, the autoplay should start. If not, open This PC and run
setup.exefrom the virtual DVD drive. - Follow the installer instructions. For Windows guest OSes, the process is automatic.
- Restart the VM after installation.
💡 Tip: For Linux guest OSes, install the
linux-azureorhyperv-daemonspackages via your distribution's package manager (e.g.,apt install linux-azurefor Ubuntu).
Step 7: Configure Networking and Test
After OS installation, check network connectivity.
- In the guest OS, open Control Panel → Network and Internet → Network and Sharing Center.
- Ensure the adapter is connected (usually named "Ethernet" or "vEthernet (External Virtual Switch)").
- Test internet access by opening a browser.
- If the network doesn't work:
- In the VM settings (Settings → Network Adapter), ensure the correct switch is selected.
- In the guest OS, update the network adapter driver (for Windows, these usually install automatically with integration services).
- Restart the VM.
Verify the Result
You have successfully created a virtual machine if:
- The VM starts and boots into the guest OS.
- The guest OS runs stably (no freezes, responsive interface).
- Networking functions: you can open websites and ping external addresses.
- You can install programs inside the VM.
- Integration services are installed (on Windows, check "Programs and Features" for "Hyper-V Integration Services").
Additionally, check performance: open Task Manager in the guest OS and verify that allocated resources (CPU, memory) match the settings.
Common Issues and Solutions
1. Hyper-V fails to enable or shows an error
- Cause: Processor doesn't support virtualization, it's disabled in BIOS, or Windows Home edition is used.
- Solution:
- Enter BIOS/UEFI (during boot press Del/F2/F10) and enable Intel VT-x / AMD-V.
- Check Windows edition:
winver. If Home, Hyper-V is unavailable—use VirtualBox instead. - Ensure there are no conflicting hypervisors (e.g., VirtualBox with Hyper-V enabled). Disable them.
2. "Not enough memory" error when creating VM
- Cause: More memory allocated than physically available, or dynamic memory with incorrect settings.
- Solution: Reduce VM memory (e.g., to 2048 MB) and/or close other applications on the host.
3. Network in VM doesn't work
- Cause: Incorrect virtual switch, missing drivers in guest OS.
- Solution:
- Verify the external switch is selected in VM settings.
- Install Hyper-V integration services (see Step 6).
- For Linux: ensure
hv_netvscmodules are loaded (lsmod | grep hv).
4. OS installation freezes or is slow
- Cause: Insufficient VM resources, ISO image issues, outdated components.
- Solution:
- Increase the number of virtual processors (but not more than physical cores).
- Verify ISO integrity (redownload or use a different one).
- Enable Memory Buffer or Memory Weight only if needed (can slow down performance).
5. "Failed to initialize hypervisor" error
- Cause: Hyper-V service not running, or conflicting features enabled (e.g., Hyper-V and VirtualBox simultaneously).
- Solution:
- Restart the Hyper-V service: in PowerShell as admin
Restart-Service vmms. - Disable other hypervisors: in "Turn Windows features on or off", uncheck VirtualBox/VMware if present.
- Restart the Hyper-V service: in PowerShell as admin
6. VM fails to start after creation
- Cause: Incorrect ISO path or VM configured for wrong boot order.
- Solution:
- In VM settings → Firmware → DVD drive, specify the correct ISO.
- Ensure in Firmware → Boot order the DVD drive is above the hard disk.