Install Hyper-V on a Windows dedicated server
Enable Hyper-V on a Windows Server dedicated server, create a NAT virtual switch without cutting RDP and start your first virtual machine. VPS limits explained.
On this page
Your values
Enter them once and the commands in this guide update.
This guide enables the Hyper-V role on a dedicated server running Windows Server, creates an isolated virtual network behind the server's IP address, then installs a first virtual machine (VM).
The proposed network uses an internal switch with NAT. This choice does not modify the physical network adapter, so your RDP connection does not depend on it.
Interface labels are given in English. They may differ if your Windows uses another display language.
Dedicated server or VPS
| Server type | Hyper-V |
|---|---|
| Dedicated server | Possible: Windows runs directly on the hardware, provided the processor and BIOS meet the requirements |
| VPS | Not guaranteed: the platform's hypervisor would have to expose virtualization to your VPS |
Why nested virtualization is not guaranteed on a VPS
A VPS is already a virtual machine. Installing Hyper-V on it amounts to nested virtualization, which depends on the platform and not on your system:
- The processor's virtualization extensions must be exposed by the physical host. You cannot enable them from inside the VPS.
- Microsoft does not support Hyper-V running on a third-party hypervisor.
- The HostMyServers VPS plan pages do not mention this feature.
So do not choose a VPS for this need. If you already have one, ask support from your customer area before attempting anything. Do not force the role installation with DISM if Windows refuses it: the server might no longer boot correctly.
Prerequisites
- A dedicated server running Windows Server 2019, 2022 or 2025, in Standard or Datacenter edition, with the Desktop Experience.
- An administrator account and an RDP session.
- IP KVM access to the server, for the BIOS and for interventions without a network. It is included on Eco and Performance servers.
- Enough memory and disk for the host and the VMs. Microsoft recommends at least 4 GB of RAM for Hyper-V, to be increased according to your VMs.
- An ISO image of the system to install, copied to the server.
- The licenses required for the guest systems: the host's license does not automatically cover your VMs. Check your entitlements with your license provider.
1. Check the hardware
Open PowerShell as administrator:
Get-ComputerInfo -Property 'HyperVisorPresent', 'HyperVRequirement*' | Format-List| Property | Expected value |
|---|---|
HyperVRequirementVMMonitorModeExtensions |
True |
HyperVRequirementVirtualizationFirmwareEnabled |
True |
HyperVRequirementSecondLevelAddressTranslation |
True |
HyperVRequirementDataExecutionPreventionAvailable |
True |
You can also run systeminfo and read the Hyper-V Requirements section.
If HyperVRequirementVirtualizationFirmwareEnabled is False, open the BIOS through IP KVM access and enable Intel VT-x or AMD-V (SVM), as well as XD or NX. The exact option names depend on the motherboard.
If HyperVisorPresent is True while Hyper-V is not installed, Windows is already running on a hypervisor or a security feature is using it. The requirements may then not be displayed. This does not prove that Hyper-V will work.
2. Install the Hyper-V role
With Server Manager
- Open Server Manager, then Manage > Add Roles and Features.
- Choose Role-based or feature-based installation, then your server.
- Check Hyper-V and accept Add Features.
- On the Create Virtual Switches page, do not select any network adapter. You will create the network later, without risk to RDP.
- On Virtual Machine Migration, leave the option unchecked.
- On Default Stores, specify a data disk if you have one.
- Check Restart the destination server automatically if required, then click Install.
With PowerShell
Install-WindowsFeature -Name Hyper-V -IncludeManagementTools -RestartReconnect over RDP after the restart, then check:
Get-WindowsFeature Hyper-V, Hyper-V-Tools, Hyper-V-PowerShell | Format-Table Name, InstallState
Get-Service vmms, vmcompute | Format-Table Name, Status3. Choose the virtual switch type
| Type | Connects the VM to | Effect on RDP | Use |
|---|---|---|---|
| Internal + NAT | The host, other VMs, then the Internet through NAT | None | Choice recommended in this guide |
| Private | Other VMs only | None | Fully isolated test network |
| External | The server's physical network | Possible disconnection | See the dedicated section |
4. Create the internal switch and NAT
The network used here is 192.168.100.0/24. Choose another one if it is already in use on your server.
Create the switch
In the graphical interface:
- Open Hyper-V Manager and select your server.
- In Actions, click Virtual Switch Manager.
- Choose Internal, then Create Virtual Switch.
- Name it
NAT-Switchand confirm with OK.
Or with PowerShell:
New-VMSwitch -Name 'NAT-Switch' -SwitchType InternalConfigure the gateway and NAT
This part is done in PowerShell only:
New-NetIPAddress -IPAddress 192.168.100.1 -PrefixLength 24 -InterfaceAlias 'vEthernet (NAT-Switch)'
New-NetNat -Name 'VM-NAT' -InternalIPInterfaceAddressPrefix 192.168.100.0/24Check:
Get-VMSwitch | Format-Table Name, SwitchType
Get-NetNat | Format-Table Name, InternalIPInterfaceAddressPrefix, ActiveWindows only accepts one NAT network of this type per host, and it does not hand out addresses to the VMs: you will configure them by hand.
5. Create the first virtual machine
First copy your ISO image to the server, for example to C:\Hyper-V\ISO. Adjust the paths if you store your VMs on another disk.
With Hyper-V Manager
- In Actions, click New > Virtual Machine.
- On Specify Name and Location, enter
VM01. - On Specify Generation, choose Generation 2, unless your system does not support it.
- On Assign Memory, enter the startup memory, for example
4096MB. - On Configure Networking, select
NAT-Switch. - On Connect Virtual Hard Disk, create a disk, for example of
80GB. - On Installation Options, choose to install from a bootable image file and select your ISO.
- Check the summary, then click Finish.
With PowerShell
$vmName = 'VM01'
$vmPath = 'C:\Hyper-V'
$isoPath = 'C:\Hyper-V\ISO\installer.iso'
New-VM -Name $vmName -Generation 2 -MemoryStartupBytes 4GB -Path $vmPath `
-NewVHDPath "$vmPath\$vmName\$vmName.vhdx" -NewVHDSizeBytes 80GB -SwitchName 'NAT-Switch'
Set-VMProcessor -VMName $vmName -Count 2
Add-VMDvdDrive -VMName $vmName -Path $isoPath
Set-VMFirmware -VMName $vmName -FirstBootDevice (Get-VMDvdDrive -VMName $vmName)
Set-VM -Name $vmName -AutomaticStartAction Start -AutomaticStopAction ShutDownFor a Linux system, Secure Boot must use the Microsoft UEFI Certificate Authority template:
Set-VMFirmware -VMName $vmName -SecureBootTemplate MicrosoftUEFICertificateAuthority6. Install the guest system
Start the VM and open its console:
Start-VM -Name 'VM01'
VMConnect.exe localhost 'VM01'In Hyper-V Manager, you get the same result by right-clicking the VM, Connect, then Action > Start. With Windows media, quickly press a key when the message Press any key to boot from CD or DVD appears.
Once the system is installed, configure its network with these values:
| Setting | Value |
|---|---|
| IP address | 192.168.100.10 |
| Mask | 255.255.255.0 (/24) |
| Gateway | 192.168.100.1 |
| DNS | 1.1.1.1 and 9.9.9.9, or your usual resolvers |
In a Windows VM, from an administrator PowerShell:
New-NetIPAddress -InterfaceAlias 'Ethernet' -IPAddress 192.168.100.10 -PrefixLength 24 -DefaultGateway 192.168.100.1
Set-DnsClientServerAddress -InterfaceAlias 'Ethernet' -ServerAddresses 1.1.1.1, 9.9.9.9On Linux, apply the same values with your distribution's network tool.
Then eject the ISO, from the host:
Get-VMDvdDrive -VMName 'VM01' | Set-VMDvdDrive -Path $null7. Verify the result
On the host:
Get-VM | Format-Table Name, State, CPUUsage, MemoryAssigned, Uptime
Get-VMNetworkAdapter -VMName 'VM01' | Format-Table VMName, SwitchName, Status, IPAddresses
Get-NetNatIn a Windows VM:
Test-NetConnection 192.168.100.1
Test-NetConnection www.microsoft.com -Port 443The second test must display TcpTestSucceeded : True. The guest's or host's firewall may block the ping of the first test without the network being at fault. Finally, check that your RDP session on the host still works normally.
Publish a service from the VM
By default, the VM is not reachable from the Internet. The simplest way to administer it is to use VMConnect from your RDP session on the host.
To publish a service meant to be public, forward a port of the host to the VM. Here, port 8443 of the host leads to port 443 of the VM:
Add-NetNatStaticMapping -NatName 'VM-NAT' -Protocol TCP -ExternalIPAddress 0.0.0.0 -ExternalPort 8443 `
-InternalIPAddress 192.168.100.10 -InternalPort 443
Get-NetNatStaticMapping | Format-Table NatName, Protocol, ExternalPort, InternalIPAddress, InternalPortAllow the port in the VM's firewall, then test from an outside machine with Test-NetConnection YOUR_SERVER_IP -Port 8443. From the host, reach the VM through its internal address 192.168.100.10: the forwarding does not work from the host.
To remove the forwarding:
Get-NetNatStaticMapping | Where-Object { $_.ExternalPort -eq 8443 } | Remove-NetNatStaticMappingExternal switch
An external switch connects the VM directly to the physical network. Windows then moves the host's IP configuration to a virtual vEthernet adapter.
A VM on this switch appears on the network with its own MAC address and needs its own IP address. Before using it, ask support, from your customer area, whether your plan allows it and how to attach an additional IP to it. Without this confirmation, stay on NAT.
Get-NetAdapter | Format-Table Name, InterfaceDescription, Status, MacAddress
New-VMSwitch -Name 'External-Switch' -NetAdapterName 'Ethernet' -AllowManagementOS $trueIn the Virtual Switch Manager, this corresponds to the External type with the Allow management operating system to share this network adapter option.
If the network does not come back, from the IP KVM console, delete the switch then check the IP configuration of the physical adapter:
Remove-VMSwitch -Name 'External-Switch' -Force
Get-NetIPConfigurationIf the address has not come back, re-enter the values you noted, as in the IP configuration guide.
Troubleshooting
The role refuses to install
Hyper-V cannot be installed because virtualization support is not enabled in the BIOS.
Hyper-V cannot be installed: Data Execution Prevention is not enabled.Enable virtualization and XD or NX in the BIOS through IP KVM access, then restart.
Hyper-V cannot be installed: The processor does not have required virtualization capabilities.On a VPS, this message generally means that virtualization is not exposed to your machine: see the section on VPS.
The VM does not start: hypervisor not running
Virtual machine could not start because the hypervisor is not running.Check the BIOS options, then the hypervisor launch type. The restart closes your RDP session:
bcdedit /enum '{current}' | Select-String hypervisorlaunchtype
bcdedit /set hypervisorlaunchtype auto
Restart-ComputerNot enough memory
Not enough memory in the system to start the virtual machine.
Could not initialize memory: Ran out of memory (0x8007000E).Reduce the VM's startup memory, stop another VM or add memory. This command shows the free physical memory on the host, in GB:
[math]::Round((Get-CimInstance Win32_OperatingSystem).FreePhysicalMemory / 1MB, 1)The VM does not boot from the ISO
No operating system was loaded.The boot prompt may have timed out: restart the VM and press a key immediately. Also check that the ISO is mounted and placed first in the boot order:
Get-VMDvdDrive -VMName 'VM01' | Format-List VMName, Path
Get-VMFirmware -VMName 'VM01' | Select-Object -ExpandProperty BootOrderA Linux image is blocked by Secure Boot
The image's hash and certificate are not allowed (DB).Stop the VM, then apply the appropriate template:
Stop-VM -Name 'VM01'
Set-VMFirmware -VMName 'VM01' -SecureBootTemplate MicrosoftUEFICertificateAuthority
Start-VM -Name 'VM01'If your system is not signed, disable Secure Boot for this VM with -EnableSecureBoot Off.
The VM has no Internet access
Check, in order, the VM's IP address, its gateway 192.168.100.1 and its DNS, then, on the host:
Get-NetIPAddress -InterfaceAlias 'vEthernet (NAT-Switch)' -AddressFamily IPv4
Get-NetNat
Get-VMNetworkAdapter -VMName 'VM01' | Format-Table SwitchName, StatusIf New-NetNat fails, another NAT network probably exists, for example one created by Docker. Windows only manages one: reuse it or, if it is no longer needed, delete it with Remove-NetNat.
The published port does not respond
Check that the service is listening in the VM, that the VM's firewall allows its port and that the forwarding exists. Test from the outside, never from the host. If the port stays closed, add an inbound rule on the host, limited to your address for the test:
New-NetFirewallRule -Name 'VM-NAT-8443-Test' -DisplayName 'VM NAT 8443 test' -Direction Inbound -Action Allow -Protocol TCP -LocalPort 8443 -RemoteAddress YOUR_IP