Installing Hyper-V inside Windows Server
In Windows Server, Hyper-V is a Windows feature you can add using the Install-WindowsFeature cmdlet. You also have the choice of whether to add the Hyper-V Management tools. These tools include the Hyper-V Manager GUI tool and the PowerShell cmdlets you use in this chapter.
Once you have installed Hyper-V, you must reboot to complete the installation. Once fully installed, you can configure the Hyper-V and Hyper-V VMs using PowerShell, as you can see in later recipes in this chapter.
Getting ready
You run this recipe on HV1
after you have installed PowerShell 7. You must also have HV2
online and likewise configured.
How to do it...
- Installing the Hyper-V feature on
HV1
,HV2
$InstallSB = {
Install-WindowsFeature -Name Hyper-V -IncludeManagementTools
}
Invoke-Command -ComputerName HV1, HV2 -ScriptBlock $InstallSB
- Rebooting the servers to complete the installation
Restart-Computer -ComputerName HV2 -Force
Restart-Computer -ComputerName...