Manually Install a Guest OS in a Hyper-V Virtual Machine

Creating and running a virtual machine is one of the first things that you will want to do after deploying Hyper-V. In this article, I will show you a basic way to manually install a guest OS in Hyper-V virtual machine (VM).

How to Install a Guest OS in Hyper-V Virtual Machines

One of the most common ways to get your first guest operating system is to mount an ISO file and install the operating system by hand, just as you would with a physical server using a DVD.

The first step is to obtain your media. If you purchased an OEM license, then create an ISO file using a third-party tool using the original Microsoft media. If you bought a volume license, then download the ISO file for your version of Windows Server from the Microsoft Volume Licensing Service Center (VLSC). If you are using MSDN media, then download the ISO from there.

Sponsored Content

What is “Inside Microsoft Teams”?

“Inside Microsoft Teams” is a webcast series, now in Season 4 for IT pros hosted by Microsoft Product Manager, Stephen Rose. Stephen & his guests comprised of customers, partners, and real-world experts share best practices of planning, deploying, adopting, managing, and securing Teams. You can watch any episode at your convenience, find resources, blogs, reviews of accessories certified for Teams, bonus clips, and information regarding upcoming live broadcasts. Our next episode, “Polaris Inc., and Microsoft Teams- Reinventing how we work and play” will be airing on Oct. 28th from 10-11am PST.

Now save the ISO file where the virtual machine can mount it. The quick and easy location is on the host. The more complicated solution that’s better in the long term is to store the ISO in a library, where a file share will require you to implement SMB constrained delegation.

Next, edit the properties of the VM. The ISO file will be mounted by a virtual DVD drive. Generation 1 VMs have a virtual DVD drive on IDE controller 1. In the case of a generation 2 VMs, you will need to add a virtual DVD drive to the VM. Browse to the SCSI Controller, add a DVD drive, and click Apply.

Browse to the DVD Drive, then navigate to the ISO file. Click OK to save your change and start the VM. Once you connect to the VM, you will then be able to use your keyboard and mouse to install the operating system.

Tip: If you are not using KMS or automated activation, then it’s a little tricky to enter the activation key. First, copy the product key into your clipboard. In the virtual machine Connect window, use the Type Clipboard Text entry from the Clipboard menu to paste in the product key when it’s required.

install a guest os in hyper-v

Connecting a Hyper-V virtual machine to an ISO file. (Image: Aidan Finn)

You are not finished when the installation is complete. Make sure that you:

  • Update the Hyper-V integration services.
  • For Windows VMs run Windows Update, reboot as required until there are no remaining updates to install.

Creating a Virtual Machine Template

If you use System Center, then you will create a template for the virtual machine. In this article, I’ll show you how to create a VM template running Windows using basic OS deployment methodology. This will save you countless hours in the future.

Most administrators should be familiar with OS cloning tools, such as ImageX, Windows Deployment Services, Microsoft Deployment Toolkit, System Center Configuration Manager, or Ghost. An operating system is generalized using Sysprep, and an image is created from the contents of the hard disk. The good news is that your guest OS is already captured in an image — the VHD or VHDX file. That makes this basic VM deployment process very easy.

When you have finished prepping your golden VM, create a checkpoint of your virtual machine, and then run Sysprep. This will open Explorer to C:WindowsSystem32Sysprep. Start SYSPREP.EXE from this folder. Sysprep should be configured to:

  • Enter System Out-of-Box Experience (OOBE)
  • Generalize
  • Shutdown

Running Sysprep in a Hyper-V virtual machine

Running Sysprep in a Hyper-V virtual machine. (Image: Aidan Finn)

It might take a few minutes for Sysprep to strip the identity of your VM and shut it down. Once the machine is powered off, copy the VHD/VHDX file to a safe location. That is your virtual machine image. The following instructions outline the deployment process:

  1. Create a VM without a virtual hard disk.
  2. Copy the golden VHD/VHDX to the new VM’s storage location.
  3. Edit the VM’s settings and connect the virtual hard disk.
  4. Power up the VM and customize it by defining the computer name, network settings, and so on.

Now you can deploy ready-to-rock VMs in a matter of minutes, where they’re already loaded with Windows Updates and your preferred configuration.

Why did I create a checkpoint (aka a snapshot) earlier? When you test your virtual machine image, you might find that you want to change something. Instead of recreating the virtual machine, you simply apply the snapshot and reverse all the changes that were done by Sysprep. Now you can make your small change and start the capture process again, starting with Sysprep.

Tip: You can also minimize the manual configuration that’s required by creating an unattended answer file and saving that into your golden image before you run Sysprep.

Related Topics:


Don't have a login but want to join the conversation? Sign up for a Petri Account

Comments (0)

Leave a Reply

Aidan Finn, Microsoft Most Valuable Professional (MVP), has been working in IT since 1996. He has worked as a consultant and administrator for the likes of Innofactor Norway, Amdahl DMR, Fujitsu, Barclays and Hypo Real Estate Bank International where he dealt with large and complex IT infrastructures and MicroWarehouse Ltd. where he worked with Microsoft partners in the small/medium business space.
External Sharing and Guest User Access in Microsoft 365 and Teams

This eBook will dive into policy considerations you need to make when creating and managing guest user access to your Teams network, as well as the different layers of guest access and the common challenges that accompany a more complicated Microsoft 365 infrastructure.

You will learn:

  • Who should be allowed to be invited as a guest?
  • What type of guests should be able to access files in SharePoint and OneDrive?
  • How should guests be offboarded?
  • How should you determine who has access to sensitive information in your environment?

Sponsored by:

Live Webinar: Active Directory Security: What Needs Immediate Priority!Live on Tuesday, October 12th at 1 PM ET

Attacks on Active Directory are at an all-time high. Companies that are not taking heed are being punished, both monetarily and with loss of production.

In this webinar, you will learn:

  • How to prioritize vulnerability management
  • What attackers are leveraging to breach organizations
  • Where Active Directory security needs immediate attention
  • Overall strategy to secure your environment and keep it secured

Sponsored by: