Windows

Hyper-V Guide

Hyper-V

Updated: 17 Oct 2021

1. How do I install Hyper-V on Windows Server?

Load Server Manager, select Add Roles and Features and install the Hyper-V role. Then you run Virtual Network Manager to create your networks, and then you can new Virtual Machines to your server.

See instructions for Hyper-V for Windows 2022.
See instructions for Hyper-V for Windows 2019.
See instructions for Hyper-V for Windows 2016 .
See instructions for Hyper-V for Windows 2012 (R2).
How to install Hyper-V on Server Core.

2. How do I Clone a VM or set up a VM Template to use for new machines?

To save time, it is a good idea to set up a VM machine which can be cloned to create new VMs with all the patches and minimum applications already installed. First you need to create a VM setup, then use the Export option to export the VM to a different location. This is ready to be used for cloning by using the Import option to create a new VM from the exported VM.

Import VM

3. How do I convert a Physical Server to a Virtual Server?

You can use the New Virtual Hard Disk wizard in Hyper-V to copy physical disks.

Then create a new VM using Hyper-V Manager using the same or better settings for processor, memory attributes but do not create a new VHD disk, instead select the option to use an existing VHD disk.

You can use an MDT server to capture the image or alternatively, use the DISM command directly (see ADK or MDT toolkit) to create an image of a disk.
e.g. DISM /Capture-Image /ImageFile:D:\Images\Disk1.wim /SourceDirectory:C:\ /Name:"Server1 Image"

Image can be converted from WIM to VHD using a PowerShell script.

A Virtual Machine can be restored to a physical machine from a full system backup. You may need to install boot disk drivers too.

4. What do the options on Hyper-V Manager mean?

  1. New
    1. New Virtual Machine - Create a new VM.
    2. New Hard Disk - Create a new virtual HD using Fixed Size, Dynamically expanding of Differencing of .vhd format.
    3. New Floppy Disk - Create a floppy file in .vfd format.
  2. Import Virtual Machine - Import a VM from a specified folder to restore, copy or duplicate files to create a VM.
  3. Virtual Network Manager - to create or modify virtual networks.
  4. Edit Disk - Option to compact, convert (dynamic to fixed), or expand size of a disk.
  5. Inspect Disk - Display location, file name, size and max size of a disk.

  6. Inspect disk

  7. Stop Service - stops the Virtual Machine Management service.
  8. Remove Server - removes server from Hyper-V Manager console (no warning given).
  9. Refresh - Refreshes window.
  10. Connect - Connects to a VM and opens a console window.
  11. Settings - Displays settings for a VM incl BIOS, Memory, Processor, IDE/SCSI Controller, Serial Ports, Diskette drives, Name, Integration Serices, Snapshot location, Start/Stop actions.
  12. Start - Powers on a VM.
  13. Turn off - Powers off a VM.
  14. Shutdown - shuts down a VM in a controlled fashion (needs OS installed).
  15. Save - Saves current State of a VM.
  16. Snapshot - Create a snapshot of a VM (.avhd).
  17. Delete Snapshot - Removes an existing snapshot.
  18. Delete Snapshot subtree.
  19. Export - Export VM files to a folder.
  20. Export

    19. Rename - Renames the Name of a VM.
    20. Delete - Removes a VM.
    21. Delete Saved State - Removes a saved state (see Save).
    22. Help - Displays help about Hyper-V.
    23. Pause - Pauses a running VM machine.
    24. Resume - Unpauses a paused VM machine.
    25. Restart - Stops and restarts a VM Machine.

5. What do the toolbar and menu options on the VM machine window mean?

Toolbar

Menus

  1. File
    1. Settings - Display settings of the vm (Ctrl+O)
    2. Exit - Close window
  2. Action
    1. Ctrl+Alt+Del (Ctrl+Alt+End) - Send Ctrl, Alt and Del key sequence
    2. Turn off (Ctrl+S) - Power off a VM
    3. Shutdown (Ctrl+D) - Shutdown a VM (needs OS installed)
    4. Save (Ctrl+A) - Save VM's state
    5. Pause (Ctrl+P) - Pause VM from running
    6. Reset (Ctrl+R) - Stop and restart a VM
    7. Snapshot (Ctrl+N) - Create a snapshot of the VM
    8. Revert (Ctrl+E)
  3. Insert Integration Services Disk (Ctrl+I) - Install drivers and VM tools
  4. Media
    1. DVD Drive >
    2. Eject
    3. Insert Disk (ISO images)
    4. Capture F:
    5. Diskette Drive >
    6. Eject
    7. Insert Diskette
  5. Clipboard
    1. Type clipboard text (Ctrl+V)
  6. Capture screen (Ctrl+C)
  7. View
    1. Full Screen Mode (Ctrl+Alt+Break)
    2. Toolbar (Ticked)
  8. Help
    1. Help Topics (F1)
    2. About Virtual Machine Connection

6. What guest operating systems can I install on Hyper-V?

64-bit Versions

32-bit Versions

The following Linux distributions are supported with LIS (Linux Integration Services) or BIS (FreeBSD Integration Services) included:

It is possible to install other similar variants of Linux on Hyper-V including:

7. How do I remotely manage Hyper-V from a client machine?

If you have Windows 7 Pro or better, install the Remote Server Management Tools (RSMT) to get the Hyper-V Tools management console.

A more advanced version for Enterprise environments is called System Center Virtual Machine Manager.

8. Can I control Hyper-V from the Command line?

Yes, if you install the Windows Powershell feature and run C:\Temp\HyperV.ps1 to load the commands, you can control Hyper-V with the following commands:

Add-VMDisk, Add-VMDrive, Add-VMVMFloppyDisk, Add-VMKVP, Add-VMNewHardDisk, Add-VMNIC,
Add-VMSCSIController, Apply-VMSnapshot, Choose-VM, Choose-VMExternalEthernet, Choose-VMNIC,
Choose-VMSnapshot, Choos-VMSwitch, Compact-VHD, Get-VMSummary, Start-VM <name>, New-VM <name>,
Start-VM, Stop-VM, Suspend-VM, Shutdown-VM, Get-VMMemory, Get-VMMemory, Get-VMSnapshot

9. How do I backup my Hyper-V VMs?

Any good backup solution that is VSS (Volume Shadow Copy) aware can be used to backup Virtual Machines.
All the virtual machines should have the Integration Services drivers and tools installed.
Dynamic disks should not be used on Virtual Machines.
Windows Server Backup should have VSS enabled for Hyper-V backup.
Make sure any existing snapshots are removed, as backups require the use of Snapshots to back up VMs.

10. Can I set up Containers for my applications?

Windows server supports containers which allow you to virtualise and contain applications on the same server.
Just install the Containers feature from Windows Server. This uses the Docker engine and client to provide containers.

You can also set up a Kubernetes cluster on Hyper-V. For example, you can install Hyper-V and setup Ubuntu 18.04 to host the
Kubernetes services. For Kubernetes on Windows nodes, see these instructions.

11. How do I set up a Virtual Switch for networking the host and VMs?

Use New Virtual Switch to setup Virtual LANs to connect your VMs to the network.