4

How to Create Hyper-V Virtual Machine

 1 year ago
source link: https://www.nakivo.com/blog/create-hyper-v-virtual-machine-complete-walkthrough/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

NAKIVO Blog > Hyper-V Administration and Backup > How to Create Hyper-V Virtual Machine: Complete Walkthrough

How to Create Hyper-V Virtual Machine: Complete Walkthrough

The goal of most organizations is to grow and expand over time. While meeting this goal, an organization also often finds it more difficult to properly and efficiently manage all aspects of its infrastructure. Modern businesses have long recognized the multiple benefits that virtualization can provide. Currently, there are multiple virtualization platforms which offer a reliable and cost-effective approach to managing the organization’s infrastructure of any scale and complexity. To meet the growing demand for virtualization, Microsoft has introduced its own virtualization technology – Hyper-V, which will be the topic of this blog post.

Data Protection with NAKIVO Backup & Replication
A Microsoft Hyper-V backup solution from NAKIVO delivers robust data protection, including backup, replication, ransomware recovery and disaster recovery. Protect virtual, cloud, physical workloads and SaaS with a single deployment. Get the Free Trial now!

About Hyper-V

Hyper-V is a hardware virtualization product developed by Microsoft, which was first introduced with Windows Server 2008. Hyper-V is  Microsoft’s native hypervisor which allows you to create multiple virtual machines (VMs) and run them on the same physical server. All VMs on the host machine run in isolation from one another and share the same virtualized hardware resources. With Hyper-V, you can manage all running VMs from a single pane of glass, namely Hyper-V Manager.

Hyper-V consolidates virtual servers onto a single physical computer, which allows you to significantly reduce the associated costs and management overhead. Moreover, Hyper-V enables better use of hardware by allocating computing resources to the VMs which need them most. Thus, you can build an easily scalable virtual environment which fully complies with your business needs and objectives.

Hyper-V is available as a server role in Windows Server and as a stand-alone product (Hyper-V Server). Moreover, Hyper-V Server is free to install. However, before you begin the process of installing Hyper-V, make sure that your system meets all of the following requirements:

  • 64-bit processor with Second Level Address Translation (SLAT)
  • VM Monitor Mode Extensions
  • Minimum 4 GB of RAM
  • Hardware-assisted virtualization (Intel VT or AMD-V)
  • Hardware-enforced Data Execution Prevention, with the NX bit for AMD systems or the XD bit for Intel systems

Installing the Hyper-V Role on Windows 10

Hyper-V is a built-in part of Windows Server 2008 and later. However, the Hyper-V role is not active by default, therefore you need to enable it manually. The process of installing the Hyper-V role is extremely easy and intuitive. There are three ways through which you can enable Hyper-V in your Windows system: Windows System Settings, PowerShell Command Line Interface (CLI), or Deployment Image Servicing and Management (DISM). The process of installing Hyper-V using Windows Control Panel, which is the most popular approach, will be demonstrated below.

  1. Type Settings in the search box situated on the taskbar below and press ENTER. The Settings app will open.
  2. Click the Apps icon.
  3. Select Programs and Features on the right under the Related Settings section.
  4. Select Turn Windows Features on or off on the left.
  5. In the Windows Features dialog box, select Hyper-V and click OK.

After the process of installing Hyper-V is complete, click Restart Now to implement all the required changes or click Don’t Restart to postpone the restart of your computer.

Creating a Virtual Switch for Hyper-V Virtual Machines

After installing Hyper-V on your computer, you may want to create new VMs in order to start building virtual environment from scratch. However, prior to that, you should first consider creating a virtual switch, which can be used to ensure communication between VMs. Moreover, a virtual switch enables the connection of VMs to both physical and virtual networks. Also, virtual switches can be used for migrating VMs from one physical host to another. For this purpose, ensure that the source host and the target host have virtual switches with the matching names.

You can create a virtual switch by using Hyper-V Manager, which can be done in the following way:

  1. Open Hyper-V Manager, select the Hyper-V host computer name.
  2. Select the Action option above. In the drop-down menu, find Virtual Switch Manager and click on it.
  3. Virtual Switch Manager will open, where you can choose the type of virtual switch that you need. There are three types of virtual switches available:
  • External switch helps to create a virtual switch which provides VMs with the access to a physical network by binding to the physical network adapter.
  • Internal switch helps to create a virtual switch which is only available to the VMs that run on this physical computer, but it does not provide access to a physical network connection.
  • Private switch helps to create a virtual switch which can be used only by the VMs that run on the same physical computer. A private network allows to create an isolated networking environment which cannot be accessed externally.
  1. Select Create Virtual Switch.
  2. Set up Virtual Switch Properties. Here, you can insert the name of the new virtual switch and type some additional information in the Notes section.
  3. Configure the connection type by choosing the network type you want the virtual switch to connect to (external, internal, private).If External, choose the type of the network adapter that you want to use. After that, check the box below if you want to allow management operating system to share this network adapter.Moreover, if you want to isolate the management Hyper-V host operating system (OS) or other VMs that share the same virtual switch from the network traffic and identify the local area network (LAN) that will be used for network communications, select Enable virtual LAN identification for management operating system. This feature is available for external and internal networks.You can manually set up VLAN ID, which will then be associated with a certain VLAN and used for future network communications.
  4. Click OK. The following dialogue window will appear.
  5. Click Yes if you want to apply the networking changes.

After that, the virtual switch will be created, meaning that your virtual environment can now use its own virtual network to facilitate VM networking.

How to Create Hyper-V Virtual Machine

There are three common ways through which you can create Hyper-V virtual machine: Hyper-V Manager, PowerShell, and Hyper-V Quick Create. All of them will be discussed in detail below.

How to Create Hyper-V Virtual Machine Using Hyper-V Manager

  1. Type Hyper-V Manager in the search box situated on the taskbar below and press ENTER. Hyper-V Manager will open.
  2. On the left, select the Actions section, find New, and click Virtual Machine.
  3. New Virtual Machine Wizard will open, presenting the set of VM options that you need to configure. They include: Before You Begin, Specify Name and Location, Specify Generation, Assign Memory, Configure Networking, Connect Virtual Hard Disk, and Summary.
  4. The Before You Begin section provides a short overview of what this wizard can do and how to use it. Read it and check the box Do not show this page again below if you want to skip this information in the future.
  5. In the next section, you can configure the VM name and location. Ensure that the VM name is unique and allows you to easily identify the required VM. As for the VM location, you can either leave the default one, or you can create a folder and assign a new location of your choice. For this purpose, check the box below and click Browse.
  6. In the Generation section, you can choose the generation of the VM. The choice between Generation 1 and Generation 2 is mainly dictated by the guest OS that you want to install. Generation 1 VMs support 32-bit and 64-bit guest OSes and BIOS-based architecture. Also, they provide functionality of the earlier versions of Hyper-V. Generation 2 VMs, on the other hand, support 64-bit Windows OSes and the latest versions of Linux and FreeBSD OSes and provide advanced virtualization features, such as Secure Boot. Take all aspects into account when choosing between the two generation types because you can’t change the VM generation after the VM has been created.
  7. In the following section, you must specify the amount of memory (from 32 MB up to 12,582,912 MB) which will be assigned to the VM. The future performance of the VM will largely depend on the amount of allocated memory. Moreover, you can choose to use Dynamic Memory for this VM by checking the box below. This feature allows you to take a part of the memory available on a physical host and assign resources to the VM which needs it most.
  8. The next step allows you to choose a virtual network that will be used for connecting the VM to the network. For this purpose, select a virtual switch that you have created earlier. If you don’t have a virtual switch, only the Not Connected option will be provided, meaning that your VM will be left without network access.
  9. Next, configure the virtual hard disk requirements. In this section, you can create a new virtual hard disk, which requires specifying its name, location, and size. Or, you can use an existing virtual hard disk (of the VHD or VHDX format). Another option is to skip this step and attach a virtual hard disk later.
  10. If you have decided to select Create a Virtual Hard Disk, the Installation Options section will appear where you can specify configurations right away or postpone it for later. Here, you can install a guest OS by choosing the ISO file. In this case, you can select one of the following variants:
  1. Install an operating system later
  2. Install an operating system from a bootable CD/DVD-ROM
  3. Install an operating system from a bootable floppy disk
  4. Install an operating system from a network-based installation server

Select one of the options and click Next.

  1. The last section is Summary, which provides a short description of this VM. Look through it once again and check to make sure everything is correct. If so, click Finish to create the VM and close the wizard.

How to Create Hyper-V Virtual Machine Using PowerShell

Even though Hyper-V Manager is extremely useful when creating and managing VMs in Hyper-V environment, only PowerShell allows you to explore Hyper-V features to the fullest. The user-friendly and intuitive interface of Hyper-V Manager has attracted multiple users, especially those who are not especially tech-savvy. However, if you want to build a large-scale virtual environment with multiple VMs running at the same time, PowerShell is the tool to choose. Depending on your needs, you can create various PowerShell scripts (also known as cmdlets), which can be used to automate daily operational tasks.

Let’s explore how you can create a new VM using PowerShell.

Type Windows PowerShell in the search bar below.

Right-click Windows PowerShell and select Run as administrator.

Run the following script

New-VM -Name Name `

-Path Path`

-NewVHDPath VHDPath`

NewVHDSizeBytes Memory `

-Generation Generation `

-MemoryStartupBytes Memory `

-SwitchName SwitchName `

It should look as follows in PowerShell:

4. Check in Hyper-V Manager to verify whether the VM has been actually created. As you can see, the newly created VM is in a powered off state, which allows you to continue the process of its configuration.

Creating VMs with PowerShell might seem challenging, but it turns out to be a rather easy process in reality. Once you have mastered it, you can create a single PowerShell Script which will fully comply with your needs. Moreover, the PowerShell script can be extended by including additional configuration options. For example, you can set up the VM memory by including the following cmdlets:

Set-VM -Name Name `

-ProcessorCount Number of Processors `

-DynamicMemory `

-MemoryMinimumBytes Memory `

-MemoryStartupBytes Memory `

-MemoryMaximumBytes Memory `

After opening the VM settings, you can verify that the changes have been adopted.

This is only a small portion of what PowerShell can do. To explore other PowerShell cmdlets and how they can help in managing a virtual environment, run this command: Get-Command -Module hyper-v | Out-GridView). You will see a list of all PowerShell commands, which you can include in your script. Type Get-Help and the Hyper-V command of your choice to find out more about this cmdlet.

How to Create Hyper-V Virtual Machine Using Hyper-V Quick Create

Hyper-V Quick Create was specifically designed to make the process of creating VMs even easier and faster, as it can be completed in just a few clicks.

  1. Open Hyper-V Quick Create.
  2. Select an OS from the list on the left, or install a guest OS from an ISO image file (.iso) or a VHD file (.vhd or .vhdx) by clicking Local installation source.
  3. Click Change Installation Source and select the required file. The Secure Boot option can be checked only if the VM will run Windows.
  4. Click More options in the lower right corner.
  5. Type the name of the VM.
  6. Choose the virtual switch.
  7. Click Create Virtual Machine to start the process.

Starting a Hyper-V Virtual Machine

After you have created the VM, you can finally start working with it. For this purpose, open Hyper-V Manager, right-click on the VM that you want to start, and select Connect. The VMConnect tool will be launched. Even if your VM is in a powered-off state, it will be booted automatically by clicking the Start button. After that, you will only be required to enter a few additional settings and you are now free to use the VM.

Watch our video for a complete walkthrough on creating Hyper-V VMs.

Hyper-V VM Protection with NAKIVO Backup & Replication

Once have built the Hyper-V environment, it is time to take care of its security so as to ensure that no critical data is lost and your system can rapidly recover in case of a disaster. NAKIVO Backup & Replication is a reliable and cost-efficient solution which provides various data protection options for Hyper-V environments of any complexity.

With NAKIVO Backup & Replication, you can perform image-based, application-aware, incremental backup and replication jobs, which ensures that the VMs, files, and application objects are stored in a transactionally consistent state, the VM data can be rapidly recovered, and only unique changes (increments) are copied to the backup repository. Moreover, you can create copies of existing backups and send them to a remote site or a public cloud (Amazon or Azure clouds). In this case, there is no need to involve production VMs as the data can be directly copied from one backup repository to another.

The latest addition to the product’s functionality is policy-based VM protection, which allows you to automate the backup, replication, and backup copy jobs. With NAKIVO Backup & Replication, you can set up policies (VM name, size, location, or other parameters), on the basis of which the solution scans the virtual environment and automatically protects the VMs that match the policy rules. This feature removes the burden of manually managing data protection jobs and significantly saves your time and effort.

Site Recovery (SR) is another data protection option which allows you to easily automate disaster recovery (DR) activities and orchestrate the entire DR process from start to finish. You can create site recovery workflows by arranging various actions and conditions into an automated algorithm which corresponds to your business needs. With site recovery, you can configure and perform such complex tasks as emergency and planned failover, non-disruptive testing of SR jobs, and datacenter migration.

Conclusion

Hyper-V provides a virtualization platform on which you can build virtual environments of varying scale and complexity. This blog post has covered the most important aspects of creating and configuring Hyper-V VMs to help you perform this challenging task. However, even the most advanced virtualization platform can’t guarantee 24/7 business continuity and data integrity without a reliable data protection solution in place.

NAKIVO Backup & Replication can provide you with a wide range of data protection options, but there are even more benefits that come with it. With NAKIVO Backup & Replication, you can enjoy complete protection of your virtual environments, high-speed backup and recovery operations, optimal use of the storage space, reduced management complexity, guaranteed recovery, and much more.

Request a live demo by one of our engineers to test the product in your virtual environment today and see for yourself the multiple benefits that it provides.


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK