Nested Virtualization and Powershell Direct in Windows Server 2016 Hyper-V Host
This blog will show on how to enable Nested virtualization as well as using Windows Powershell Direct which are both new features in Windows Server 2016 Hyper-V Host.
Host Detail:
Name - VINCE
Set-VM –VMName powershell-direct-g1 –MemoryStartUpBytes
4GB
Windows PowerShell
Direct create remote sessions and run windows powershell cmdlets on a
remote host. It can only be used from the host to the virtual machine
Requirements:
·
The
host must be running Windows Server 2016 or Windows 10
·
The
guest must be running Windows Server 2016 or Windows 10
·
Windows
PowerShell must be running as administrator
·
You
must use credentials to authenticate to the virtual machine
Nested Virtualization
enables a hyper-V guest virtual machine to be a Hyper-V host as well.
Requirements:
·
At least 4GB of static memory
·
MAC address spoofing enabled
·
Virtual machine configuration version 8.0
For this blog, I will use pre-created VM
that is already in configuration version 8.0 I will show how to set it up.
NOTE:
To upgrade configuration version of your VM from version 5 to 8.0, First, turn
off your virtual machine and then, right click your virtual machine and click
upgrade configuration version.
OS Version - Windows Server 2016
Virtual
Machine Details:
Name
– Powershell-Direct-G1
OS
Version – Windows Server 2016
Configuration
Version – 8.0
----------------------------------------------------------------------------------------------
First, Enable Expose Virtualization
Extension so
that applications that require hardware virtualization can run on virtual
machines without binary translation. In Windows Powershell type the
following commands and press enter:
Set-VMProcessor –VMName Powershell-Direct-G1 –ExposeVirtualizationExtensions
$true
Then, Enable MAC Adddress Spoofing. It
allows virtual machines to change the source MAC address in outgoing packets to
one that is not assigned to them.
NOTE: You can
run nested virtual machine without enabling MAC address spoofing. But you
might encounter some issues when it comes to network traffic.
Get-VMNetworkAdapter –VMName powershell-direct-g1
| Set-VMNetworkAdapter –MacAddressSpoofing On
Lastly, Set Memory Startup Bytes to at least
4GB. Remember that 4GB is the minimum static memory required to run nested
virtual machine.
Now, Let’s test the virtual machine if we can now install
Hyper-V feature.
On windows Powershell,enter a command:
Start-VM –VMName powershell-direct-g1
You should see that the Virtual machine starts.
Use Windows Powershell to remotely manage virtual
machine.
Enter-PSSession –VMName powershell-direct-g1
You should see that you must enter the
credentials for virtual machine
You can see the virtual machine name on the powershell
windows which means that you are now connected to remote session
Next, Install Hyper-V feature in virtual machine and restart it to apply the installation
Install-WindowsFeature -Name Hyper-V -IncludeAllSubFeature -IncludeManagementTools -Restart
After the installation, It will automatically restart
After the virtual machine restarts, Re-connect to windows powershell direct session
Enter-PSSession -VMName powershell-direct-g1
then supply credentials required.
once connected again, check if Hyper-V feature is installed.
in Powershell windows enter this command:
Get-WindowsFeature -Name Hyper-V
You can see that it is now installed.
Hope it helps a lot.
If you have any concerns/questions, just comment and i will respond as soon as i can.
Thank you!
Maraming Salamat Sir Vince :)
ReplyDeleteYou are welcome :)
Delete