How to Setup and Use Hyper-V in Windows 10 for OS Virtualization

Information
Windows 10 ProEducation and Enterprise editions come with a built-in hypervisor client Hyper-V allowing users to create and run other operating systems on a virtual machine. Although Hyper-V is mainly designed to run Windows guests it can also be used to virtually install other operating systems like various Linux versions.
In this tutorial we will enable and setup Hyper-Vcreate virtual switches to allow our virtual machines to communicate with network and Internetand finally create some sample virtual machines.
Although starting from the basics this tutorial might give some tips to the more advanced userstoo :).

Note
Please notice:
Hyper-V is only available in Windows 10 ProEducationand Enterprise
editions.
It is not available in Windows 10 Home.
See also:
Contents:
Part One: Some vocabulary
Part Two: Setup Hyper-V
Part Three: Create a virtual switch
Part Four: Create a Windows virtual machine (Windows 7 or later)
Part Five: Create a legacy Windows vm (Windows Vista or earlier)
Part Six: Create a Linux vm
A short list of some terms worth to know.
- Hypervisor
- Hypervisor or virtual machine monitor (VMM) is a piece of computer softwarefirmware or hardware that creates and runs virtual machines (Wikipedia)
- Hyper-V
- Hyper-V is a native hypervisor; it can create virtual machines on x86-64 systems. Starting with Windows 8Hyper-V supersedes Windows Virtual PC as the hardware virtualization component of the client editions of Windows (Wikipedia)
- Virtual Machine (vm)
- A virtual machine (VM) is an emulation of a particular computer system. Virtual machines operate based on the computer architecture and functions of a real or hypothetical computerand their implementations may involve specialized hardwaresoftwareor a combination of both (Wikipedia)
- Host or Host SystemHost OS
- Host is the computer and operating system running the virtualization platform (in this case Hyper-V in Windows 10 host) to host your virtual machines (guests)
- Guest or Guest SystemGuest VM
- A virtual machinea guest operating system installed on a vm and stored on a Virtual Hard Disk (vhd)
- Virtual Hard Disk (vhd)
- A vhd file emulates a physical hard disk. It can contain a full operating system on a virtual machineor it can be used to store files as any physical hard disk
- Virtual Switch
- A virtual switch emulates a physical network adapter. A Hyper-V vm cannot directly connect and use the network adapters on your hostit needs a virtual switch in between. The vm sees and treats the virtual switch as a network adapter and uses it to communicate with the physical host network adapterwhich then forwards all communications further to network
How to enable and set up Hyper-V virtualization.
2.1) By default the Hyper-V is disabled. To start we need to enable it as follows:- Open
Programs and Features (OptionalFeatures.exe).
- Click
Turn Windows features on or off:
- Select
Hyper-Vclick
OK:
- Windows will now install the required components. You have to reboot to let Windows finalize the installation:

2.2) After the reboot launch Hyper-V Manager:- Press
WIN + S and type
Hyper-V to Start Menu searchclick
Hyper-V Manager:
- Alternatively if using
Start Screen instead of Start Menuenter
Start Screen and start typing
Hyper-V to open
Charms search and search
Hyper-Vselect
Hyper-V Manager:

Tip
A tip from our admin
z3r010 (
original post):
If you get an error message about
Hypervisor not runningopen an
elevated Command Prompt by pressing
WIN + X and selecting
Command Prompt (Admin) and give the following command:
bcdedit /set hypervisorlaunchtype auto
Reboot the host PC. Hyper-V should now be able to run.
2.3) Hyper-V should automatically connect to your host (left pane) and show the menu on right pane:
2.4) If the left pane shows no Hyper-V servers to connect (your local host computer)click Connect to server on the right paneselect Local computer in the dialog that follows and click OK:2.5) If you want to change the location where your virtual machines will be savedclick Hyper-V Settings and change the location:
Part Three
Create a Virtual Switch
How to create a virtual switch to allow virtual machines to communicate with network.

Note
Since Windows 10 version 1709Hyper-V now includes a default virtual switch named simply as Default. Creating your own external virtual switches is no longer required to get Internet connection to virtual machines.
Howeverto guarantee best networking capabilities between host machine and its virtual machinesit is recommended to create an external switch and use it instead. Using Default switch is totally OK if networking between host and Vm is not required.
3.1) Before creating our first virtual machine we must create at least one virtual switcha bridge between the virtual network adapter on vm and the physical network adapter on host.
A Hyper-V vm has no way to connect to network without this bridge. The image below shows how a Hyper-V vm connects to network:
Above image is from a Virtual Switch tutorial at our sister site The Eight Forumssee full tutorial for more in-depth information on Virtual Switches. In this tutorial we jump ahead and just create a virtual switchfor those users wanting to know more about virtual switches I recommend to read said Eight Forums tutorial.
3.2) Click Virtual Switch Manager (right paneHyper-V Manager):
3.3) Select New virtual network switchselect Externalclick Create Virtual Switch:
3.4) Name your new virtual switch as you want toselect External network and using the drop down listselect a host network adapter you want to assign to this switchclick OK:
Apply changes by clicking Yes in following dialog:
Hyper-V will now create the switch.
Notice that for a vm to be able to communicate with networkit has to use a virtual switch which in its turn must be connected to a working host network adapter connected to network. In this example I assigned the host WiFi adapter to the new external virtual switch. If the WiFi adapter on host is disabled or not connected to network when the vm using this switch is launchedthe vm cannot connect to the network.
You can have a virtual switch connected to each of host's network adapterstypically one connected to a LAN adapter and another connected to a WLAN adapter. A host network adapter can only be connected to one virtual switch at any given time.
Looking at your network adapters now you can see that virtual switches are workingand that the host WiFi adapter is bridged to a virtual switch (subject to a virtual switch with WiFi adapter assigned to it exists):

Note
When Hyper-V is enabled and one or more external virtual switches createdyour host system uses these switches instead of host physical network adapters to connect to the network. This is as it should bedo not remove or disable the virtual switches!
Part Four
Create a Windows virtual machine (Windows 7 or later)
How to install a Windows operating system to a new virtual machine.
4.1) Click New > Virtual Machine on the right pane (Action):
4.2) Click Next:
4.3) Name your vm as you wishclick Next (if you want to save the vm in other than default locationselect Store the virtual machine in a different location):
4.4) Select the vm generation. Generation 2 (GPT / UEFI) can only be used for 64 bit Windows 8 or later respective Windows Server 2012 or later guest operating systems. For all other guest systems use Generation 1 (MBR / BIOS). Click Next:
4.5) Assign RAM to vmselect Use Dynamic Memory for this virtual machineclick Next.:
The RAM assigned to a vm is taken from your host RAM; if you assign 1 GB to a vmwhen it's run your host is missing this 1 GB. I recommend you try first following values if your host has 4 GB RAM or less:
- Host 2GB RAM > assign max 512 MB
- Host 2 to 4 GB RAM > assign max 1 GB
Selecting the Dynamic memory lets Hyper-V to be flexibleuse only the amount of RAM needed at any given moment. In Windows virtual machinesHyper-V uses the amount you gave it at startup of the vm but then when it's not neededit releases some of it back to hostgetting again more when it needs it.
4.6) Select an existing virtual switch to allow the vm to connect to network. Click Next to continue:
4.7) Select how big the virtual hard disk can be. For Windows guests20 GB is enough if you just want to test an OS and will not install any appsbut the more you give to vhdthe more you can install apps and store files on it. Click Next to continue:
Notice that by default Hyper-V uses a dynamically expanding vhd; even if you create a 500 GB vhd for your vmif only 25 GB is used after you have installed an OS and some appsthe vhd file size on your host hard disk is only 25 GB. In this case the 500 GB only means that the vhd has your permission to grow to be so big if it needs more storage space. If you plan to do some heavy work and install a lot of programs to your vmgive it a bigger vhd.
4.8) Select the install media for your vm. If you install from a CD or DVD disk on your host CD/DVD driveselect Physical CD/DVD drive and from drop down list select the correct drive. In this example I chose to use an ISO file containing Windows 7 Ultimate installation files. Click Next to continue:
Notice that a 2nd Generation vm can only be installed from an ISO imagetherefore if you selected 2nd Generation in step 4.4 the option to use a DVD drive is not available.
4.9) Review your vm settings (highlighted yellow)if OK click Finish to create your vm:
4.10) Your vm has been created. On right paneclick Connect (#1) and wait until the vm windows has openedthen press Start (#2) to boot the vm:
4.11) Ready! The vm boots:
4.12) You can now install the operating system on your vm exactly as you would do it on a physical computer:
Part Five
Create a legacy Windows virtual machine (Windows Vista or earlier)
How to install an older Windows operating system to a new virtual machine.
5.1) Follow the procedure in Part Four until Step 4.6where instead of selecting a virtual switch select Not Connected:
5.2) Continue setting up the vm as told in Part Four from Step 4.7 to Step 4.9. Do not launch the vm yet
5.3) Right click your vm in the middle pane of the Hyper-V Managerselect Settings:
5.4) Remove the NIC:
5.5) Select Add hardwareselect Legacy Network Adapterclick Add:
5.6) Connect the legacy adapter to an existing external switchclick OK:
5.7) Now you can launch the vm as told in Part Four Step 4.10 and start installing your OS.
Part Six
Create a Linux virtual machine
How to install Linux to a new virtual machine.
For instructions in installing Linux on a Hyper-V virtual machineplease see the tutorial on our sister site The Eight Forums: Hyper-V Create Linux Virtual Machine in Windows 8
I will update this part with more recent screenshots and instructions as soon as I have finished installing a few most common Linux distros to Windows 10 Hyper-V.
Have fun with virtualization!
Kari