Windows:Hyper-V

From Define Wiki
Jump to navigation Jump to search

Enabling Hyper-V

  • We can install the Hyper-V role in Windows Server 2016 easily with the Install-WindowsFeature cmdlet, note that after installation a reboot is required.
  • We can specify this to happen straight away with the -Restart flag, or otherwise we can omit this and perform the restart later.
  • Open the Windows PowerShell and enter the command:
Install-WindowsFeature -Name Hyper-V -IncludeManagementTools -Restart

Installing a VM from image file

  • In the Server Manager, click the Tools drop down menu, and select Hyper-V manager.
  • On the left panel, select where you want to install the VM, the default option should be the server you are working on.
  • On the "Actions" panel, click Import Virtual Machine to open a new window.
  • Press next on the "Before you begin" tab.
  • In the "Locate Folder" window, press "Browse" and select the folder the image is in.
  • Select the Virtual Machine to be installed.
  • Select the import type from the following:
Register in-place – This type assumes export files are in the location where you'll store and run the virtual machine. The imported virtual machine has the same ID as it did at the time of export. Because of this, if the virtual machine is already registered with Hyper-V, it needs to be deleted before the import works. When the import has completed, the export files become the running state files and can't be removed.

Restore the virtual machine – Restore the virtual machine to a location you choose, or use the default to Hyper-V. This import type creates a copy of the exported files and moves them to the selected location. When imported, the virtual machine has the same ID as it did at the time of export. Because of this, if the virtual machine is already running in Hyper-V, it needs to be deleted before the import can be completed. When the import has completed, the exported files remain intact and can be removed or imported again.

Copy the virtual machine – This is similar to the Restore type in that you select a location for the files. The difference is that the imported virtual machine has a new unique ID, which means you can import the virtual machine to the same host multiple times.
  • Click Finish.

Enabling a Virtual Switch

  • In the "Actions" panel, select "Virtual Switch Manger"
  • Select Internal, External or Private switch and click "Create Virtual Switch"

Connecting your VM to the Virtual Switch

  • Select your VM from the "Virtual Machines" list
  • In the right panel, under where the VM is listed, select settings.
  • Select "Network Adapter" and then choose your the Virtual Switch you created.