How to create Virtual Machine using Hyper-V

Requirement : Basic Understanding of Virtualization.

Hyper-V is a hypervisor use to manage Virtual Machines. It uses Virtualized Networking and Virtual Hard Disk to depict a Virtual System which can run any OS.

Basic Points :
Virtual Hard Disk Extension : vhdx
Virtual Machine Extension : vmcx

Virtual Machine  Configuration Version 8.2 (for windows Server or 10 – 1709)
8.0 (for Windows Server or 10 – 1607 or lower)

OS Supported : OS Support for Hyper-V
I would recommend using Windows 10 (Build 1607 or later) or Windows Server 2016 for this.

Installing Hyper-V

Windows 10

Install Hyper-V

Windows Server
Go to – > Server Manager -> Manage -> Add Roles and Features

Snag_9cb11ef

Alternatively, Powershell script for Windows Server

Install-WindowsFeature -Name Hyper-V

HyperV-GUI Management Tools :
If you only want to manage Hyper-V for other/remote computers install this only. if you want to run virtual machines on you system then include Hyper-V Platform.

Host Machine :
Host Machine refers to the Machine which provided resources for Virtualization to Hypervisor. In this case this will be your Desktop/Laptop.

Warning : Do not install multiple Hypervisors at same time on same machine. They won’t work. Only one hypervisor at any point of time can manage virtualized resources of system. if you have installed VMWare Workstation Pro / VirtualBox etc. please uninstall them otherwise you will encounter error when opening Hyper-V manager window.

Open Hyper-V manager after system restarts.

Configure Networking

If you are planning to connect your VM to the network then go through this step else skip to “Creating Virtual Machine”

Open “Virtual Switch Manager” from right pane.

  1. Click on “New Virtual Network Switch” on left pane. There are 3 types of switches you can create in Hyper-V.
    External : if you want your VM to communicate outside your Host Machine (in this case it will be Desktop or Laptop)
    Private : if you are creating multiple VM’s and want them to communicate with each other only and not with Host Machine or outside your Host Machine. In case of single VM you don’t require it.
    Internal : same rules as Private, the only difference being the VM’s can communicate to Host Machine also.
  2. Provide a name for Virtual Switch. I will prefer the naming convention as per type of switch then what is this used for. For eg.
    LABNET : if you are using this for your LAB
    Internet : if you are using it to connect to internet.
    Remember : You can only create one External/Internal Switch on one Network Adapter. You can create as many Private switches you want.Snag_9d7069b
    If you are not able to recognize right network adapter execute following powershell command.

     Get-NetAdapter

    Snag_9de6fc2

  3. If you are creating this switch for internet purpose make sure you select the checkbox “Allow management operating system to share this network adapter”
    otherwise your host machine will not be able to access internet.
  4. Create Private or Internal switch if you want, but follow the naming convention as this will be easy for you to identify switches.

Creating Virtual Machine

  1. Select your machine on Left pane and click on New -> Virtual Machine on right pane. Mention any name you want. If you want Custom Location Check the checkbox and provide another location.

    Note : The location shown in Screenshot is respective to my machine. For yours it will be different.

    Snag_9b0f4b1

  2. Select “Generation 2” on next step.

    Note : if you are installing very old operating system like WindowsXP or earlier versions of Linux then select Generation 1.

  3. Provide Startup Memory of 2048 MB. Check the option of “Use Dynamic memory for this Virtual Machine”.

    Note : There is no thumb rule to select the memory. we are selecting sufficient enough to boot and install the OS. Once OS is installed we can reconfigure it to lower amount.

  4. If you have created any Switch select that on next page.
  5. Provide a name for the Virtual Hard Disk (VHD) for your machine. Generally you should keep same name as your VM name, so that it is distinguishable from other VM’s.
    Size : 20 GB is more than sufficient if you are not installing client OS like Windows 10/8/8.1/7. In that case choose 60 GB.
    Location :  Specify a different location for your hard disk (preferrable).
    Don’t select the Option “Use Existing Virtual Hard Disk”. we use that in case where we have pre-installed and Sysprepped OS on VHD.

    Sysprep : it is windows utility to pre-configure the OS image for multiple installations. For eg. you can install windows OS and then install Chrome Browser on it. Sysprep it and then you can use this image to install on 10 computers and all of them will have by default Chrome installed.

  6. Choose to install an OS. Download ISO image for whatever OS you want to install and provide the path to it.
  7. Click Finish and the new VM will reflect in your window.
  8. By Default Hyper-V assigns only 1 virtual core to the VM. after VM is created go to VM settings and change the no. of cores to 2.
  9. Click Start and Connect to VM and installation process will Start. Just follow the regular OS installation as you do.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s