How to create Virtual Machine using Hyper V

by | Mar 6, 2024 | Computer, Windows | 0 comments

Hyper-V, Microsoft’s hardware virtualization product, enables users to create and run software versions of computers called virtual machines (VMs). Each VM acts as a full-fledged computer, capable of running its own operating system and applications independently.

This capability is invaluable for IT professionals, developers, and businesses needing to test applications, manage server resources, or consolidate hardware. Hyper-V offers a scalable and flexible platform for modern IT infrastructure, helping organizations meet today’s dynamic digital demands with ease.

Getting Started with Hyper-V

Before you begin creating VMs, make sure Hyper-V is enabled on your system. Hyper-V is available on:

  • Windows 10 Pro, Enterprise, or Education
  • Windows 11 Pro, Enterprise, or Education
  • Windows Server editions

To enable Hyper-V:

  1. Click the Start Menu and type Turn Windows Features On or Off, then press Enter.

    Accessing Windows Features to enable Hyper-V
  2. Scroll down and find Hyper-V.
  3. Check the box next to Hyper-V and click OK.
  4. Windows will install the required components and prompt a reboot.

    Enable Hyper-V feature in Windows

Step 1: Launch Hyper-V Manager

Once Hyper-V is enabled:

  1. Open the Start Menu, search for Hyper-V Manager, and launch it.

    Opening Hyper-V Manager

Step 2: Configure Your Virtual Network

To allow communication between VMs and the internet, create a virtual switch:

  1. In Hyper-V Manager, click on Virtual Switch Manager in the right pane.

    Virtual Switch Manager in Hyper-V
  2. Select New virtual network switch and choose the type:
    • External: Connects VMs to a physical network and internet.
    • Internal: Communication between VMs and host only, no internet access.
    • Private: Communication only among VMs, fully isolated from host and internet.
  3. Name your switch, configure the settings, and apply.

    Selecting external virtual switch

    Creating a new virtual switch

Step 3: Create the First Virtual Machine

  1. In Hyper-V Manager, right-click on your computer name and select NewVirtual Machine.

    Starting new virtual machine creation
  2. Launch the New Virtual Machine Wizard and click Next.

    Hyper-V new virtual machine wizard
  3. Name your VM and choose the storage location.

    Naming new virtual machine
  4. Select the generation:
    • Generation 1: Legacy BIOS-based VM.
    • Generation 2: UEFI-based VM with newer features (recommended if supported).

      Choosing VM generation
  5. Assign memory, enabling Dynamic Memory if desired.

    Assigning memory to VM
  6. Connect your VM to the virtual switch created earlier.

    Connecting virtual machine to switch
  7. Create a virtual hard disk, specifying size and location.

    Creating virtual hard disk
  8. Choose installation media — ISO file or bootable CD/DVD.

    Selecting OS installation source
  9. Review your settings and click Finish to create the VM.

    Finishing virtual machine creation

Step 4: Duplicate Virtual Machines

To create multiple VMs without repeating the entire setup:

  1. Locate the original VM’s VHD or VHDX file.
  2. Copy and rename the VHD/VHDX file.
  3. Use Hyper-V Manager to create a new VM, selecting Use an existing virtual hard disk and pointing to your copied file.

Step 5: Automating VM Creation with PowerShell

PowerShell is a powerful way to automate VM creation. Example:

New-VM -Name "VMName" -MemoryStartupBytes 2GB -NewVHDPath "C:\VMs\VMName.vhdx" -NewVHDSizeBytes 40GB -SwitchName "YourVirtualSwitch"

Modify the script to batch-create multiple VMs efficiently, saving setup time and ensuring consistency.

Best Practices for Managing Multiple VMs

  • Use a Consistent Naming Convention: Eases management and identification.
  • Monitor Resource Allocation: Adjust memory and CPU as needed to avoid resource contention.
  • Implement Regular Backups: Protect VMs and critical data by backing up virtual disks.

Creating virtual machines in Hyper-V empowers you to build flexible, scalable environments for testing, development, or production. Whether you’re manually configuring VMs or using PowerShell automation, Hyper-V simplifies virtualization for modern IT needs.

Expand your Hyper-V knowledge:

Reference:

Frequently Asked Questions

Is Hyper-V free?

Yes, Hyper-V is included at no extra cost with Windows 10/11 Pro, Enterprise editions, and all Windows Server editions.

What is the difference between Generation 1 and Generation 2 VMs?

Generation 2 VMs support UEFI firmware, Secure Boot, and modern hardware features, whereas Generation 1 uses BIOS emulation.

Can Hyper-V run Linux virtual machines?

Yes, Hyper-V supports various Linux distributions, including Ubuntu, CentOS, Red Hat, and more.

Can I use Hyper-V on Windows 10 Home?

No, Hyper-V is not available on Windows 10 Home edition. Upgrade to Windows 10 Pro or higher to use Hyper-V.

How many VMs can I run on Hyper-V?

The number depends on your system resources (RAM, CPU, storage). Hyper-V scales to support dozens or even hundreds of VMs on powerful hardware.

Related Articles

The Future of Network Automation

The Future of Network Automation

Network automation is reshaping how IT professionals manage infrastructure—replacing repetitive manual tasks with intelligent, efficient processes....