Between the blog and studying for MS certification exams
a few years back, I had 6 virtual machines (VMs) running on my laptop, all running
in Oracle VM VirtualBox.
I wrote an article titled “Working with Virtual Machines” (17 Jun 18) that focused
on using Oracle VM VirtualBox as the
hypervisor, the software that allows you to run virtual machines on your
computer. Oracle VM VirtualBox is a type 2 hypervisor, meaning that it’s an application that runs within your OS
to host your VMs.
Hyper-V was originally released with Server 2008 and is
available up through Server 2019. The nice thing about Hyper-V is that it’s not
limited to running in the Server OS. You can install the feature and run it in
Windows 8 Pro, Windows 10 Pro, and Windows 11 Pro. Depending on your level of
geek-ness, you can install Hyper-V and run your own VMs on your own computer.
I used Oracle VM VirtualBox for several
years and really liked it. Current MS certification exams, however, focus on Hyper-V
virtualization, so it became obvious that I had to change hypervisors for
hands-on experience. With that in mind,
I decided to migrate my Oracle VM VirtualBox VMs to Hyper-V.
It was a spectacular failure. Of my 6 VMs, the only one that I was able to
migrate was THOR, my Win7 Pro SP1 (x64) VM. The import failures were caused by
the differences in how Oracle VM VirtualBox and Hyper-V
handle virtual hardware, mainly hard drive controllers. In the end, I was only able
to import my Win7 Pro VM and had to build the others from scratch (again). But,
that’s not the point of this article.
Assuming that you plan to use Hyper-V for a home training
lab, the first thing to consider is to make sure you’re running a 64-bit (x64)
version of Win8, Win10, or Win11. Right click on the Start button, and then click
on “System”.
- In the “Device Specifications” section you’ll find the “System type”, which will say if you’re running a 64-bit operating system.
- The “Windows Specification” section will tell you which OS and version you’re running.
Once you confirm your OS, there are only a few simple
steps to installing the feature.
- Launch your Control Panel and then click on “Programs and Features”.
- Click on “Turn Windows features on or off”.
- Click on the box next to “Hyper-V” to check the box and install all the components.
- Click “OK”.
After rebooting and logging in to your PC, the first
thing you may want to consider doing is creating a NAT’ed network for your VM
lab. That is, unless you want them to run off the same network as all your
other devices. And, there’s nothing wrong with that. But, since my lab will
contain two Domain Controllers with DHCP, I opted to create a NAT’ed network.
Hyper-V () doesn’t allow you to create NAT’ed networks within the console, so
you have to launch PowerShell and run the following commands, inserting a name
for the network where I have “name”:
New-VMSwitch -SwitchName “name” -SwitchType Internal
Get-NetAdapter
New-NetIPAddress -IPAddress 192.168.1.1 -PrefixLength 24 -InterfaceAlias "vEthernet (name)"
New-NetNAT -Name "vNAT" -InternalIPInterfaceAddressPrefix 192.168.1.0/24
Get-NetAdapter
New-NetIPAddress -IPAddress 192.168.1.1 -PrefixLength 24 -InterfaceAlias "vEthernet (name)"
New-NetNAT -Name "vNAT" -InternalIPInterfaceAddressPrefix 192.168.1.0/24
The easiest way to find and launch Hyper-V Manager is to
click on the Search box and type “Hyper”.
In the right panel menu, click on “New” and then “Virtual
Machine….”.
Name your new VM and select a storage location for it, if your location is other than the default. Click “Next”.
Choose the generation that you want your VM to be.
Usually Generation 1 is okay, unless you need to support UEFI secure boot. I’m
building this VM as a Win10 Pro (x64) VM specifically with the intent of
upgrading it to Win11, so it has to be Gen 2 with secure boot. I’ll link to an
article at the bottom of the page that explains Gen 1 vs. Gen 2 more
thoroughly.
Enter how much RAM you want / need. I’m going with 4 GB
because anything less for a Win10 VM is pretty much useless.
Select your network connection from the dropdown menu. I’m using the NAT’ed network I created a few months ago that I use for a private subnet for my VMs.
Configure your virtual hard drive (VHDX). I left the default name and location based on the information I provided earlier for the name and location of the VM. The only thing I changed was to downsize the VHDX from the default 127 GB to 100 GB.
Select your network connection from the dropdown menu. I’m using the NAT’ed network I created a few months ago that I use for a private subnet for my VMs.
Configure your virtual hard drive (VHDX). I left the default name and location based on the information I provided earlier for the name and location of the VM. The only thing I changed was to downsize the VHDX from the default 127 GB to 100 GB.
Select your installation options. I browsed to the
storage location and selected the Win10 Pro (x64) ISO. It’ll be mounted as a
virtual optical device and emulate the process of installing the OS from a DVD
drive.
With the new VM selected, click on “Settings” in the lower right panel. Click on “Firmware”.
Click on the hard drive and click “Move Up” to place it ahead of the Network Adapter.
Click on Security. Make sure “Enable Secure Boot” is checked, it should be by default. I also checked “Enable Trusted Platform Module” since it’s a requirement for the Win11 upgrade.
Click on memory and confirm the settings. The only change I made was, in Dynamic Memory, I changed the maximum to 4096 to match the amount of assigned to the VM. Dynamic memory allows the VM to only use what it needs without locking in the full amount. That allows the difference to be used by the host or other VMs.
Click on “Processor” and increase it from 1 to 2, or however many your host will allow.
I expanded out the options for the Network Adapter and clicked on Advanced Features. I manually changed the MAC address from Dynamic to a static address. This isn’t necessary, but it’s my preference to keep it in line with my other VMs. Also, this will become necessary later on for working with DHCP reservations.
Next, I clicked on “Checkpoints” and unchecked the box next to “Enable checkpoints”. I don’t want Hyper-V to automatically create checkpoints. If I need one later on, I can enable the option and manually create one.
At this point, make sure you save your changes and exit the settings. The only thing left to do is power on the VM and install the OS.
I’m skipping the process of installing the guest OS because I already covered that in several earlier article (listed below). Once I have the OS installed and fully patched, I’ll post an article on doing the in-place upgrade from Win10 to Win11.
- Make sure you have enough RAM before you start. You need enough RAM in your host and you need to allocate an adequate amount to your VM(s). You can configure Hyper-V to set minimum and maximum RAM allocations, but you need to make sure from the start that you have enough. It’s not like Oracle VM VirtualBox where you set the memory allocation in the beginning and that’s what it uses. RAM use in Hyper-V can fluctuate based on what you allocate and what processes your VM is running at any given time.
- Make sure you have plenty of HDD space. I initially tried running my VMs off an external USB HDD like I did with Oracle VM VirtualBox. Hyper-V doesn’t seem to like that and the VMs run very slowly. My current laptop has a secondary internal drive that’s dedicated almost entirely to my VMs, so it’s a lot faster and lest finicky, but there’s still some disk access lag.
- Installing and Configuring Windows 7, 06 May 18
- Installing and Configuring Windows 8/8.1, 13 May 18
- Installing and Configuring Windows 10, 20 May 18
- Working with Virtual Machines, 17 Jun 18
- Hyper-V
- How to Migrate VirtualBox VMs to Windows 10 Hyper-V
- What is Hypervisor and what types of hypervisors are there
- Should I create a generation 1 or 2 virtual machine in Hyper-V?
- Comparing Hyper-V Generation 1 and 2 Virtual Machines
- Understanding Hyper-V Generations (Gen 1 & Gen 2)
No comments:
Post a Comment