How to Use Hyper-V Virtual Machines

Share this article

Hyper-V is a native hardware-assisted virtualization platform provided in Windows 8 Pro and Windows Server 2008 R2 and above. In essence, a Virtual Machine is a PC emulation running on your PC. You install VM software on your physical host machine, then boot up and install any number of guest OSs. Popular VM software includes VMware
, VirtualBox and Microsoft Virtual PC (which was used to power XP Mode in Windows 7). VMs are essential for web developers:
  1. They allow you to test alternative browsers such as historical versions of IE or Linux installations.
  2. You can set up development servers such as Linux with Apache, PHP and MySQL on a Windows development PC.
VMs are hard disk images so they can be backed-up, cloned and moved far easier than a real PC. In addition, most VM software allows you to make snapshots so you can test software or configurations and revert back in the event of catastrophic failure. Hyper-V has a number of benefits including speed, multi-core processor support and booting to VMs (users can use a guest VM as their daily OS so they can’t trash the host). But the main advantage is that VMs operate in the background. There’s no need to start the software; it’s always running and controlling your booted guest OSs. Similarly, there’s no need to open or connect to the guest OS desktop — if you’re running a development server, you can simply transfer files like you would to any other device on your network. So let’s look at the basics of using Hyper-V. I’m using Windows 8 but Windows Server is similar.

1. Enable Hyper-V

From the Windows Control Panel, select Programs and Features followed by Turn Windows features on or off. Check Hyper-V and all platform and tools sub-components. It’ll take a few minutes to install.

2. Configure Hyper-V Defaults

From the Start screen (or Win+Q), run the Hyper-V Manager. You can change the default settings in Action > Hyper-V Settings
. Hyper-V settings

3. Create a New Virtual Machine

To create a new VM, select Action > New > Virtual Machine…. Enter a name for your VM and select a different file location if necessary: Hyper-V create VM wizard Now enter the amount of memory you want the VM to use — keep it as dynamic unless you want to specify a maximum: Hyper-V create VM wizard You can now create or use an existing hard disk image and specify a maximum size (it will grow as the VM requires more space): Hyper-V create VM wizard Finally, you can choose to install an operating system from a physical drive or ISO image: Hyper-V create VM wizard Hit Finish to complete the wizard. You can now boot your VM (click Start
in the Actions pane) and install a guest OS. Remember this occurs in the background; to view the desktop, click Connect… in the Actions pane. Hyper-V boot guest OS Note that the VM will not be able to connect to a network yet — you may wish to configure that first so updates can be downloaded.

4. Connecting to Your Network

Connecting to the network is slightly unusual compared to other VM software. Hyper-V creates a virtual switch device which is subsequently used for all host and guest connectivity. Under the right-hand Actions pane, click Virtual Switch Manager…. Select External and hit Create Virtual Switch. Hyper-V virtual switch Assign a name (Virtual Switch is as good as any), select the real network adapter used for networking on your host OS, and hit Apply. The dialog can then be closed. Now, right-click your VM and choose Settings…
(or click Settings… under your VM in the Action pane). Select the Network Adapter tab and ensure Virtual Switch (or whatever you named it) is selected. Hyper-V virtual switch Reboot your VM and, with luck, you should have network connectivity. Network Troubles? Many people experience networking problems with Hyper-V guests — I did. A separate hardware NIC adapter is recommended, but this is impractical for most desktop and laptop PCs. If you can’t connect or connectivity randomly drops, try the following remedies:
  1. Configure the guest OS to use a fixed IP address.
  2. If it continues to fail, disable TCP Checksum Offload and UDP Checksum Offload in your physical NIC adapter settings (they may have slightly different names).

5. Connect to Your VM

As mentioned, you can click Connect… in the VM’s Action pane to view the desktop. Alternatively, you can use Microsoft’s Remote Desktop Connection tool much like you would with any networked Windows device. Hyper-V offers some great features which will benefit web developers. Do you have any interesting uses for the platform?

Frequently Asked Questions (FAQs) about Hyper-V Virtual Machine

What is the difference between Hyper-V and other hypervisors like VMware?

Hyper-V is a type of hypervisor, which is a software that creates and manages virtual machines. It is developed by Microsoft and is included in Windows 10 and Windows Server. On the other hand, VMware is a product of VMware Inc., and it also provides similar functionalities. The main difference between the two lies in their architecture and compatibility. Hyper-V is a type 1 hypervisor, meaning it runs directly on the system hardware. VMware can be either a type 1 (ESXi) or type 2 (Workstation, Fusion) hypervisor, depending on the product. Both have their own unique features and the choice between the two often depends on the specific requirements of your virtual environment.

How do I create a virtual switch for Hyper-V virtual machines?

A virtual switch is essential for creating a network connection for your virtual machines in Hyper-V. To create a virtual switch, open the Hyper-V Manager, select the host where you want to create the switch, and then click on ‘Virtual Switch Manager’. You can then choose the type of switch you want to create – external, internal, or private. After configuring the necessary settings, click on ‘OK’ to create the switch.

Can I run Hyper-V on any version of Windows?

Hyper-V can be run on certain versions of Windows. It is included with Windows Server, Windows 10 Pro, Enterprise, and Education. However, it is not available on Windows 10 Home edition. Also, your system must meet certain hardware requirements to run Hyper-V, such as a 64-bit processor with Second Level Address Translation (SLAT), VM Monitor Mode extensions, and at least 4 GB of RAM.

What is the role of a hypervisor in virtualization?

A hypervisor, like Hyper-V, plays a crucial role in virtualization. It allows you to create and run multiple virtual machines on a single physical machine. Each virtual machine operates as a separate computer, running its own operating system and applications. The hypervisor manages the resources of the physical machine, such as CPU, memory, and storage, and allocates them to the virtual machines as needed.

How does Hyper-V compare to other virtualization technologies?

Hyper-V is a robust and feature-rich virtualization technology. It supports a wide range of operating systems, provides extensive hardware support, and includes features like dynamic memory, live migration, and virtual switch. Compared to other virtualization technologies, Hyper-V is deeply integrated with Windows, which can make it easier to use for organizations that are heavily invested in the Microsoft ecosystem. However, other technologies like VMware or VirtualBox may offer different features or better compatibility with certain systems, so the best choice depends on your specific needs.

Can I use Hyper-V for free?

Yes, Hyper-V is included for free with certain versions of Windows, such as Windows 10 Pro, Enterprise, and Education, as well as Windows Server. However, you will need a valid license for the Windows operating system.

How can I enable Hyper-V on my Windows system?

To enable Hyper-V on your Windows system, you need to go to ‘Turn Windows features on or off’ in the Control Panel. From there, you can check the box for Hyper-V and click on ‘OK’. Your system will then install the necessary components and may need to restart.

What is a Hyper-V virtual machine?

A Hyper-V virtual machine is a software emulation of a physical computer, running an operating system and applications just like a physical computer. You can create multiple virtual machines on a single physical machine using Hyper-V, each with its own virtual hardware and isolated from the others.

Can I convert my physical machine to a Hyper-V virtual machine?

Yes, you can convert a physical machine to a Hyper-V virtual machine using a process known as Physical-to-Virtual (P2V) conversion. This involves creating an image of the physical machine’s hard drive and then using that image to create a virtual machine in Hyper-V.

What are the benefits of using Hyper-V for virtualization?

Using Hyper-V for virtualization offers several benefits. It allows you to make better use of your hardware resources by running multiple virtual machines on a single physical machine. It also provides flexibility, as you can easily create, delete, and move virtual machines as needed. Additionally, it can improve business continuity by making it easier to backup and restore systems, and it can provide a more secure environment by isolating virtual machines from each other.

Craig BucklerCraig Buckler
View Author

Craig is a freelance UK web consultant who built his first page for IE2.0 in 1995. Since that time he's been advocating standards, accessibility, and best-practice HTML5 techniques. He's created enterprise specifications, websites and online applications for companies and organisations including the UK Parliament, the European Parliament, the Department of Energy & Climate Change, Microsoft, and more. He's written more than 1,000 articles for SitePoint and you can find him @craigbuckler.

Hyper-VVirtualBoxVirtualizationVMVMware
Share this article
Read Next
Get the freshest news and resources for developers, designers and digital creators in your inbox each week
Loading form