Step-by-Step Guide: Enabling Hyper-V on Windows 11 and Creating a VM via PowerShell

Step-by-Step Guide: Enabling Hyper-V on Windows 11 and Creating a VM via PowerShell

Hyper-V is a virtualization technology that is valuable for developers and system administrators. By using Hyper-V virtual machines, multiple operating systems and apps can be run on a single physical machine. Enabling Hyper-V on a Windows 11 computer allows for the elimination of the need for physical hardware, saving time and costs, while also providing the flexibility and convenience of running different operating systems and applications on a single device.

In this Step-By-Step guide, you will learn how to enable Hyper-V on your Windows 11 device. The guide covers everything from checking your computer's compatibility to configuring the Hyper-V settings, giving you a thorough understanding of how to use Hyper-V on a Windows 11 enabled device.

Determining System Compatibility: Step 1 for Enabling Hyper-V on Windows 11

Before proceeding with enabling Hyper-V on your Windows 11 machine, it's crucial to ensure that your system meets specific requirements. These include running Windows 11 Pro or Enterprise 64-bit Operating System, having a 64-bit processor with Second Level Address Translation (SLAT), a minimum of 4 GB of RAM, and BIOS-level hardware virtualization support.

To check your system's compatibility, follow these simple steps:

  1. Press the Windows key + R to open the Run dialog box.
  2. Type "msinfo32" and press Enter.
  3. Scroll down to the "System Summary" section and locate the "Hyper-V Requirements" line. If it shows "Yes", your system is compatible with Hyper-V.

Enabling Hyper-V on Windows 11: Step 2 of the Process

Once you have confirmed that your system is compatible with Hyper-V, you can proceed with the following steps to enable it on your Windows 11 device:

  1. Press the Windows key + R to open the Run dialog box.
  2. Type "appwiz.cpl" and press Enter.
  3. In the Programs and Features window, select "Turn Windows features on or off" from the left-hand pane.
  4. In the Windows Features window, scroll down to "Hyper-V" and check the box next to it.
Enabling Hyper-V in the Windows Features dialog box

5.   Click on OK and wait for the installation process to complete.

6.   Once the installation is complete, click on Restart Now to restart your computer.

Configuring Hyper-V Settings: Step 3 of the Process

After successfully enabling Hyper-V on your Windows 11 device, you can further optimize your virtual machine performance by configuring specific settings. Here are some essential settings you may want to consider:

Hyper-V Manager dialog box
  • Virtual Switches: Configuring virtual switches can help your virtual machines connect to your network, allowing them to communicate with other devices and access the internet.
  • Virtual Hard Disk: Adjusting the virtual hard disk size can ensure that your virtual machine has enough storage space to run smoothly.
  • Processor and Memory: Assigning the appropriate amount of processor cores and memory to your virtual machine can enhance its performance and responsiveness.
  • Integration Services: Enabling integration services can help your virtual machine run more efficiently by allowing it to communicate with your Windows 11 host.

By configuring these settings, you can ensure that your virtual machine performs optimally, providing you with a seamless and efficient computing experience.

Creating a Windows 11 Virtual Machine using PowerShell

PowerShell is a powerful command-line shell, scripting language, and configuration management framework that enables IT professionals to automate routine tasks related to system administration. It is a cross-platform tool that works on Linux, macOS, and Windows, allowing users to streamline administrative tasks across different operating systems.

When it comes to creating a virtual machine on Hyper-V, PowerShell offers an efficient and effective method for automating the process. With PowerShell, advanced computer users and IT professionals can quickly create a virtual machine and configure its settings, including the virtual hard disk, processor, memory, and network settings.

By leveraging the power of PowerShell, users can simplify and accelerate the process of creating virtual machines, allowing them to focus on more critical tasks related to system administration and management.

Mounting the Windows 11 ISO Image in PowerShell: Step 1 of the Process

After enabling Hyper-V, follow these steps to download and mount the Windows 11 ISO image:

  1. Download the Windows 11 ISO file from the Microsoft website.
  2. Once the download is complete, right-click on the downloaded file and select Mount to mount the ISO image.
  3. Wait for the ISO file to mount, and then take note of the drive letter assigned to the mounted ISO file.

Configuring VM Settings in PowerShell: Step 2 of the Process

To set up the VM in PowerShell, follow these steps:

  1. Open the Windows 11 search box and search for PowerShell.
  2. Right-click on PowerShell and select "Run as administrator".
New-VM -Name "Windows 11" -MemoryStartupBytes 4GB -Generation 2 -NewVHDPath "C:\HyperV\Windows11.vhdx" -NewVHDSizeBytes 60GB
Note: This command creates a new virtual machine with the name "Windows 11," 4GB of RAM, and a virtual hard disk of 60GB. Feel free to modify as needed.

3.   To configure the network adapter for the VM, use the following command:

Add-VMNetworkAdapter -VMName "Windows 11" -SwitchName "Default Switch"
Note: The following command sets the network adapter for the VM to use the default switch.

4.   Enter the following command to attach the Windows 11 ISO file to the VM:

Add-VMDvdDrive -VMName "Windows 11" -Path "D:\Sources\install.wim"
Note:Replace D with the drive letter assigned to the Window 11 ISO file mounted in Step 2.

Deploying the Virtual Machine: Step 3 of the Process

Once you have finished configuring the VM settings, the next step is to deploy the Windows 11 VM on Hyper-V. Here are the steps you need to follow:

1.   Enter the following PowerShell command to start the VM:

Start-VM

2.   Once the VM is started, connect to the VM console by typing the following command:

Connect-VMMServer -ComputerName "localhost" -Credential (Get-Credential)</li-code
Note: This command connects you to the VM console using the local computer as the Hyper-V server.

3.   To install Windows 11 on the VM, simply follow the on-screen instructions and select the appropriate language, time zone, and keyboard options.

4.   After the installation is complete, shut down the VM by typing the following command:

Stop-VM

Using PowerShell to create a Windows 11 VM on Hyper-V is a simple and efficient process that can save time and effort for students setting up the solution. By following the outlined steps, you can create a fully functional Windows 11 VM on Hyper-V more quickly than using the GUI, which is especially helpful for those who need to deploy multiple VMs quickly and efficiently. PowerShell is an excellent tool to automate the entire process and ensure that each VM is configured correctly.

If you require further assistance, please don't hesitate to contact me.

Contact me via,
Mail: tycho.loke@peoplerock.nl
Phone: +31 6 39 41 36 65
LinkedIn: Tycho Löke