Step-by-Step Guide to Setting Up Hyper-V Virtual Machines on Windows 11

Although it may appear that virtual machines (VMs) have been an integral part of technology for ages, their inception in Microsoft’s ecosystem began with Windows Server 2008, which featured the debut of Hyper-V virtualization technology. It wasn’t until the technical preview of Windows 8 in May 2012 that Hyper-V and its VM capabilities were available on a desktop OS from Microsoft.

Since that milestone, Hyper-V VMs now make up about one in every ten VMs utilized worldwide—a significant statistic considering the extensive use of VMs in cloud environments. Here, we’re counting VMs by the billions, underlining their fundamental role in tech infrastructure (and no, we’re not counting hamburgers).

There are compelling reasons for Windows 11 users and administrators to implement VMs on their PCs, far beyond the capacities typically employed in cloud settings. These reasons include the practical benefits of running VMs locally in various contexts.

Microsoft equips Windows 11 with two specific tools designed for crafting Hyper-V VMs. This guide outlines some foundational knowledge, explores how to navigate these tools, and discusses the limitations inherent to each method.

Hyper-V is a type of hypervisor, which is a software that allows the creation, operation, and management of multiple virtual machines on a single physical machine. It effectively constructs a virtual environment where an administrator can specify attributes for one or more virtual machines.

These attributes can include virtual CPUs and cores, virtual memory, virtual storage, virtual network interfaces, and a virtual operating system. Virtual machines utilize these resources to execute commands and run applications, each within its own separate, isolated environment.

Inside a virtual machine, Windows operates just as it would on a standard computer. Externally, the hypervisor manages interactions with the host operating system and bridges the virtual resources of the VM with the physical resources from the host.

Computers equipped with Hyper-V Manager (which is integrated into Windows) or other hypervisors like VMware Workstation are known as host PCs. The virtual machines on these hosts serve as clients to the hypervisor.

Because a Windows VM is a virtualized instance of a Windows operating system, Windows 11 VMs must meet the system requirements of Windows 11. Additional requirements specific to Hyper-V are also necessary:

Currently, there are two methods to configure a Hyper-V VM on Windows 11: a standard method and a developer-focused approach. The standard method involves using the Hyper-V Manager to set up and manage VMs. Conversely, the developer-focused method, introduced in April 2024, utilizes a new Microsoft utility known as Dev Home (Preview), accessible through the Microsoft Store.

This developer-focused method is generally simpler and involves fewer hurdles than the traditional approach. However, as will be detailed in the Dev Home section, there is a complication to consider.

Although included in newer versions of Windows, Hyper-V is not activated by default. To enable it, navigate to the Windows Features in the Control Panel (Control Panel > Programs and Features > Turn Windows features on or off).

Click the top-level Hyper-V item. By doing this, you activate both the Hyper-V platform itself (Hyper-V Platform) and the Hyper-V Management Tools needed to operate VMs through the Hyper-V Manager or a remote access method, such as the Remote Desktop Connection (strongly known as mstsc.exe), or the Remote Desktop app.

I also generally enable the Windows Hypervisor Platform as indicated. After selecting these options, click OK, and Windows will proceed with the installation and activation.

Figure 1: Enable the top-level Hyper-V and the Windows Hypervisor Platform components.

Windows Features will locate, set up, and activate the required components to manage Hyper-V Manager and the necessary support to operate Hyper-V VMs under its control. Once Windows Features completes this process, a message displays: “Windows completed the requested changes.” You’re also notified that a system restart is required to complete the setup.

You must reboot your computer before you can start utilizing the Hyper-V platform. To do so, simply click on the “Restart now” option found in the lower right corner as shown in the referenced image.

An image description noted: Click “Restart now” to prepare your PC for Hyper-V VM activities!

After restarting your computer, you can find the Hyper-V Manager by typing “hyper” into the search box of the Start menu, where it appears as the top result.

Once the system has restarted, the Hyper-V Manager is fully functional and ready for use.

Initiating the Hyper-V Manager directly from its host desktop—referred to as a local launch—is generally the simplest method for setting up a Hyper-V VM. When you first use Hyper-V Manager, it displays nothing as no virtual machines (VMs) are set up initially.

Figure 4: When run for the first time, Hyper-V Manager shows precisely nothing.

If you click Quick Create, the top item in the right-hand menu you can soon remedy this situation. By default, Microsoft provides pointers to various predefined runtime environments, including evaluation versions of Windows 10 and 11 aimed at developers and (until early July) three different Long Term Servicing (LTS) branches for Ubuntu Linux (which may be freely offered to anyone who’s interested).

The right-hand side of Figure 5 shows the details for the “Windows 11 dev environment” item, an evaluation copy worth installing as a short-lived example. Select the OS you want to install and click Create Virtual Machine.

Figure 5: Select Windows 11 dev environment (left), then click Create Virtual Machine (lower right).

This downloads a ~21GB Windows image file. (On my Lenovo P16 Mobile Workstation, a 12th-Gen x86 platform, that took about 5 minutes to complete, including image verification.) Then, Hyper-V Manager creates a VM, extracts the virtual boot/system disk, verifies the image again, and completes (this takes another 5 minutes or so), as announced in Figure 6. Click Connect to hook up the new test VM inside Hyper-V Manager.

Figure 6: VM successfully created. Next step: click Connect.

What happens next is that Hyper-V Manager opens a virtual machine window. You must start the VM to turn it on, as described. If you were using an ISO, this is when the process of installing Windows inside the VM would occur.

Before you can interact with a VM, you must start it up: click Start!

But because Microsoft has generously provided a ready-to-use VM for this development setup, clicking Start initiates a boot-up process (“Getting ready”) that lasts about a minute. Subsequently, you can log into a Windows 11 desktop (username is User, with no password needed). This is your introduction to your first Hyper-V VM!

Although it requires at least 15 minutes to complete, this process is as quick and straightforward as the creation of a VM can be. The VM is displayed within a Hyper-V Virtual Machine Connection window, confirming its operation on the title bar.

The Windows 11 Dev Environment VM start menu clearly emphasizes a developer-centric layout.

Initializing a Virtual Machine (VM) from an existing virtual hard disk (a .vhdx file and its configuration) is quite straightforward. Essentially, this process involves activating and operating a pre-configured VM that’s almost ready to use.

Another method for creating VMs is visible in previous illustrations such as Figure 5. Here, you can select the “Local installation source” button at the bottom left of the “Create Virtual Machine” interface. This action allows you to browse your local drives to select an ISO — a commonly used disk image format for installing Windows. (Here are some good sources for Windows ISOs.)

This method gives you the flexibility to choose any version of Windows you prefer. However, since it involves installing the operating system on a new VM, it requires more time and effort to ensure everything is set up correctly.

After selecting the Local Installation source button as demonstrated in Figure 5, and navigating to the E: drive where a Windows 11 Insider Preview ISO dated May 30 is stored, it becomes a designated source for a Hyper-V VM. The next steps, including the creation of a VM using this ISO, are shown in Figure 9. Here, you must click on Create Virtual Machine (located at the bottom right) to proceed with using the local ISO for VM creation.

By utilizing an ISO through File Explorer, you facilitate the creation of a virtual machine, making all filesystem resources accessible for VM configuration.

Upon selecting Create Virtual Machine, the Hyper-V wizard proceeds with the ISO. After accepting the defaults, the instance is initially labeled as “New Virtual Machine” within the Hyper-V Manager. Renaming it requires a right-click on the label in the “Virtual Machines” section, followed by selecting Rename from the context menu, changing its name to “Win11.26100.” This is subsequently reflected as such in the following description.

Now renamed to Win11.26100, indicative of its primary Windows 11 build number, the new VM awaits installation.

Because we’re working from an ISO file, we must now install this OS image before it can run as a VM. This is where timing becomes sensitive: once you click Connect, then click the Start button, you must be ready to hit the proverbial “any key” (because any key will do) to start the installer running. If you wait too long, you’ll see a PXE boot message instead, and the install will go no further. Be prepared and act fast!

If all goes well, you’ll see the Windows 11 setup screen “Select language settings.” After that, it’s just matter of marching through the Windows install process, so I won’t track that further except to note that you will need a valid product key for whatever version of Windows you’re installing.

By default, you will encounter a problem: At some point, you’ll get the error message “This PC doesn’t currently meet Windows 11 system requirements.” That’s because Hyper-V Manager Quick Create does not enable the Trusted Platform Module (TPM: special, secure chip-level storage used for hardware keys and other highly sensitive system data) by default.

Turn off the VM by selecting Action from the top menu and then choosing Turn off. On the main Hyper-V Manager screen, choose the VM you are setting up (in this case, Win11.26100), then select Settings located at the lower right. This action opens the Settings page for the Win11.26100 VM. Navigate to Security. In the Security section, although Secure Boot is activated, TPM is not. Tick the Enable Trusted Platform Module checkbox. Following this, click Apply and OK.

Figure 11 shows that TPM must be activated before installing Windows 11. By default, Hyper-V Manager does not enable this, so you need to adjust it manually.

After these adjustments, clicking Connect should allow the installer to proceed to completion.

Once the process is complete (this took roughly 40 minutes on my powerful P16 Mobile Workstation), you will see the familiar Windows within a VM interface. Now you’ve added another virtual machine to your Hyper-V collection.

Alongside the Quick Create feature, Hyper-V Manager also presents a New > Virtual Machine option. This alternative offers improved direct control over the comprehensive settings and choices available during the setup of a Hyper-V VM.

The New > Virtual Machine feature allows enhanced granularity in managing configurations when setting up a new VM.

Using this option opens a New Virtual Machine Wizard that guides you through the complete process of VM specification. It allows you to specify a name, choose a file system location, select a VM generation, assign memory, and manage networking, virtual hard disk, and installation options. Note that managing the TPM setting still requires manual intervention as mentioned earlier.

The New Virtual Machine Wizard systematically takes users through VM creation and settings.

In the subsequent explanations, I will demonstrate creating a new Windows 11 VM for version 24H2 (Build 26100.863) acquired from the Insider Preview downloads page. The Specify Name and Location screen illustrates that I’ve named the VM Win11.24H2 and opted for the default location for the virtual hard disk file.

Figure 14: The VM name is designated as Win11.24H2, followed by clicking Next to proceed.

Typically, all Hyper-V VMs are set as Generation 1 by default. However, since Generation 1 does not meet the requirements for a Windows 11 VM, it is essential to choose the Generation 2 option to install a Windows 11 VM, as indicated in Figure 15.

Figure 15: Select the Generation 2 option to fulfill the requirements for a Windows 11 VM.

The next step is to allocate 8GB (8,192MB) of RAM, which is double the default amount, for the Win11.24H2 VM.

Double the defaults (8GB instead of 4GB) this time around, please.

The following action is to choose the Default Switch as your selection for the Connection type under the Configure Networking section, as indicated in Figure 17. It is crucial to remember that the default setting is “Not connected,” indicating no network access for the VM. Using Default Switch allows the VM to access networks that the host PC can connect to. Should your host configuration define additional switches, these will also be shown in the dropdown menu for this VM setting, available for use if preferred.

Figure 17: Opt for Default Switch to enable network (and internet) connectivity for the VM.

The subsequent phase involves linking a virtual hard disk that the VM will utilize, sticking to the previously cited default location. Alternatives here include “Use an existing virtual hard disk” (used in the previously described development environment to source its contents) and “Attach a virtual hard disk later” (permits the completion of the VM setup without the need to allocate or connect a virtual hard disk). Please refer to Figure 18 for more specific information regarding Win11.24H2.vhdx.

Figure 18: This represents the default allocation (127GB) for Hyper-V VM virtual hard disks.

Next comes the engaging section: linking the virtual machine to an ISO file and deciding how (or if) to proceed with the installation. This area is labeled “Installation Options” on the left-hand side. Here, we’ll connect to the ISO I obtained from the Insider Preview downloads page and set it to install the OS from this image, as depicted in Figure 19.

Figure 19: The selected radio button instructs the installer to locate a specific Windows 11 ISO file.

At this point, the wizard is finished, so click Summary on the left to show your work so far. It will show all the settings you’ve made. Click Finish to complete the VM creation process. Then, you’ll return to Hyper-V Manager, where you now see a VM named Win11.24H2 in the upper center “Virtual Machines” pane.

The new VM, Win11.24H2, is turned off. That’s good!

Before proceeding with the installation of Windows 11.24H2, there’s an important configuration step required in your new virtual machine. As previously mentioned, enabling the TPM in the VM’s security settings is crucial. Once completed, you can commence with the Windows 11 OS installation as outlined earlier.

The tutorial on using Hyper-V Manager and setting up virtual machines has now been covered. Moving forward, let’s delve deeper into the specifics.

Virtual Machines (VMs) operate entirely through remote access, lacking any physical connection to common peripherals such as a mouse, keyboard, or monitor. Instead, virtual components must be assigned to their physical counterparts which include not just the aforementioned peripherals but also CPUs, RAM, storage, networking, among others. Additionally, one primary advantage of VMs is their capability to support remote access from any location via a network connection to a central hypervisor.

However, utilizing the Remote Desktop Protocol (RDP) through either the Remote Desktop Connection or the Remote Desktop app in conjunction with a Hyper-V hypervisor can introduce several challenges. These challenges are notably distinct from those previously discussed, like initiating the Windows Installer for an ISO-based installation or enabling TPM, which are necessary for the installation process to proceed successfully.

For starters, you can’t start a new Windows 11 VM from inside an RDP session, as it needs to access and mount the specific Windows 11 ISO to launch its Setup.exe. For reasons not fully clear, this is only possible from a direct login on the host machine (not through an RDP session). If you initiate the Start process as indicated in a depiction, during an RDP session, the VM does not proceed to boot and launch Setup.exe.

Indeed, selecting Start results in a black screen appearing in the VM window, rather than triggering the Windows 11 setup process. You must power down the VM (select Action in the top menu, then choose Turn off). Afterwards, utilize the Start command from the actual host PC, using the local input devices. Once Setup.exe begins operation, the VM can then be accessed via an RDP session to display the initial Windows 11 setup interface.

Once Setup.exe has initiated, RDP into the VM is feasible if desired.

The following complication arises after you choose the Install now option. During the Windows activation process, as shown in a hypothetical Figure 22, you’ll notice it’s impossible to copy and paste a Windows activation key into the Activate Windows dialog box. This functionality only becomes available in an enhanced session within RDP, which is not accessible until after the installation of Windows 11. This issue is further compounded by default Windows Hello login settings, which are incompatible with the enhanced session’s copy-and-paste capabilities.

At the key prompt in the Activate Windows dialog, manual entry of the key is mandatory due to the aforementioned restrictions.

You will need to input the 25-character combination of letters and numbers that make up your Windows key by hand. Alternatively, there’s the option to use the 30-day evaluation version of the Windows 11 developer environment, which requires no activation key but offers limited access time.

But there’s one more RDP gotcha to surmount: you can’t log in to your new desktop until you uncheck the “Enhanced session” option in the View menu for the RDP session. Once you do that and log in, click Settings > Accounts > Sign-in options, then turn off the toggle under “Additional settings” that reads For improved security…. Then you can switch back to an enhanced session and log in using a password or a PIN.

Note that “Enhanced session” in the View menu up top is unchecked. Turn off the toggle under “Additional settings.” Then you can re-enable that option so that cut and paste will work in RDP.

Thanks to our earlier efforts in this story, you’ve got yourself some working Windows 11 VMs set up mostly using Hyper-V Manager’s defaults. By setting up the plain-vanilla, all-default Win11.26100 VM via Quick Create and the slightly modified Win11.24H2 VM that follows it through the New Virtual Machine Wizard, you can learn a lot about what makes a VM tick, as well as provisioning defaults.

Defaults in VM settings are influenced by the physical properties of the computer running Hyper-V Manager. For example, a less powerful machine will result in VMs with reduced capabilities in comparison to those created on more robust machines, such as a Lenovo P16 Mobile Workstation, which boasts 24 cores, 64GB of RAM, and roughly 4 TB of total storage, including a 2 TB boot/system drive.

Generally, the default configurations suggested by Hyper-V Manager for new VMs are quite satisfactory. Experienced users can tweak these settings to better suit their needs, although lowering them below the suggested defaults might not be beneficial unless the host machine’s specs are limiting.

For more info on Hyper-V and VMs: A free 45-minute module titled “Configure and Manage Hyper-V virtual machines” is provided by Microsoft Learning for further learning. Additionally, for detailed explorations, the Windows 11 Forum offers an extensive collection of tutorials under its “Virtualization” section, consisting of 54 tutorials covering various VM-related topics.

On April 23, 2024, Microsoft released version 0.13 of its Dev Home (Preview) developer toolbox, introducing a feature called “Environments.” This new support allows for enhanced abilities to create, manage, and configure Hyper-V VMs and Microsoft Dev Boxes, which are detailed in the GitHub Dev Home Preview v0.13 release notes.

Many readers might not find Dev Boxes (a service from Azure designed to boost developer productivity by providing easy access to configured, project-specific development environments in the cloud, requiring an Azure subscription) particularly interesting. Those who consider using Hyper-V VMs should pay attention, as these VM features necessitate Windows 11 22H2 or newer.

Having encountered various challenges as mentioned earlier that hamper the setup and utilization of VMs via Hyper-V Manager, I was eager to explore whether Dev Home (Preview) offered a smoother experience. I purposely accessed Dev Home using an RDP session from a different computer. Within Dev Home, I selected the Environments option, which was indicated by a small blue highlight on the left.

The display in Dev Home showed existing VMs and included an option for “New Virtual Machine.”

Ed Tittel / IDG

Dev Home successfully recognized and displayed the status of all pre-existing VMs on the P16, identifying them as “Environments.” Particularly interesting was how quickly the process to set up a new Hyper-V VM commenced upon clicking the Create Environment button located at the upper right corner:

This indicated the selection of the Microsoft-supplied “Windows 11 dev environment” as the source image for the new VM.

After initiating the Create Environment button, one needs to be patient. Dev Home commences with the download of the Windows 11 dev environment, a file exceeding 20GB, followed by the extraction of its contents. On the P16 Mobile Workstation, this entire process took approximately 15 minutes. Throughout this duration, Dev Home provides updates on the progress, for instance, indicating when the download is 76% complete.

Progress in downloading the ISO for the Windows 11 development environment is currently at 76%.

Once the extraction is complete, the ISO will be mounted, and the virtual machine will be ready to launch. The screen displays Environment information for the newly created VM (termed NewVM2), as depicted in the next figure. It is essential to click the Launch button on the far right to initiate the VM installation process.

Upon clicking the Launch button, the Windows installer for the VM’s operating system will start.

When you do that, a small VM window opens to present you with a Start button to fire things off. Click that Start button!

Click the Start button to put Setup.exe to work to install the VM’s OS.

This starts the VM, which activates the ISO image’s Setup.exe, opening a larger VM window labeled Hyper-V with a circular progress indicator. You will then be prompted to resize the VM window for optimal viewing (a minimum of 1680 x 1050 is recommended). Subsequently, a login window appears for a generic “User” account, which does not require a password, as indicated. Remarkably, this process typically completes in two minutes or less. Click Sign in to proceed to the desktop.

Once logged in, you will encounter the NewVM2 desktop, which presents a minimal Windows 11 installation that notably includes Visual Studio 2022 and Ubuntu on Windows. At the time of writing, it is operating on the Enterprise Evaluation build 22621.3447. It has been confirmed that using a valid Windows 11 Enterprise key to activate this setup is not possible, as it rejects all keys.

But here we are, having installed a working Hyper-V VM for Windows 11 from start to finish inside an RDP session! Thus, the Dev Home approach completely sidesteps all gotchas one encounters when using Hyper-V manager, to wit:

There’s just one problem: Dev Home environments don’t let you grab an arbitrary local ISO on a drive. You can only use Environments that Microsoft makes available (these are essentially the same as the “gallery images” shown in Figure 9 earlier in this story).

For any other Windows images you might want to run as VMs, you must use Hyper-V Manager and its quick or slow create processes — that is, unless Microsoft responds to my feature request to add access to local ISOs to Dev Home’s existing image options when creating a VM.

What I learned from digging into Dev Home and its capabilities — especially when using RDP — is that it’s entirely possible for Microsoft to update and rationalize its Hyper-V VM creation process. Whether or not they choose to do so is up to them. I certainly hope they’ll figure this out, and do just that.

Ideally, Microsoft would update Hyper-V Manager to be optimized for Windows 11. Additionally, incorporating local ISO access as an option for image selection in Dev Home would be beneficial. While I would be satisfied with either enhancement, having the possibility to modify a VM created in Dev Home via the extensive settings in Hyper-V Manager is always there. Nonetheless, despite the desirability of both updates, I remain skeptical about seeing them implemented soon.


Posted

in

by

Tags: