Hyper-VVirtualizationVMs8 min read

Install and configure Hyper-V

Enable Hyper-V on your Windows VPS to create and manage virtual machines.


Hyper-V lets you create virtual machines inside your Windows Server VPS to isolate services or test configurations.

Step 1 — Install the Hyper-V role

powershell
Install-WindowsFeature -Name Hyper-V -IncludeManagementTools -Restart

The server restarts automatically.

Step 2 — Verify installation

powershell
Get-WindowsFeature Hyper-V
Get-Command -Module Hyper-V | Measure-Object

Step 3 — Create a virtual switch

powershell
# Internal switch (VM-to-VM communication)
New-VMSwitch -Name "InternalSwitch" -SwitchType Internal

# External switch (internet access)
New-VMSwitch -Name "ExternalSwitch" -NetAdapterName "Ethernet" -AllowManagementOS $true

Step 4 — Create a virtual machine

powershell
# Create VM with 2 GB RAM and 40 GB disk
New-VM -Name "VM-Ubuntu" -MemoryStartupBytes 2GB -Generation 2 -NewVHDPath "C:\VMs\VM-Ubuntu.vhdx" -NewVHDSizeBytes 40GB -SwitchName "ExternalSwitch"

Step 5 — Configure the VM

powershell
# Assign processors
Set-VMProcessor -VMName "VM-Ubuntu" -Count 2

# Configure dynamic memory
Set-VMMemory -VMName "VM-Ubuntu" -DynamicMemoryEnabled $true -MinimumBytes 1GB -MaximumBytes 4GB

# Mount installation ISO
Add-VMDvdDrive -VMName "VM-Ubuntu" -Path "C:\ISOs\ubuntu-22.04-server.iso"

# Configure boot order
Set-VMFirmware -VMName "VM-Ubuntu" -FirstBootDevice (Get-VMDvdDrive -VMName "VM-Ubuntu")

Step 6 — Manage VMs

powershell
# Start VM
Start-VM -Name "VM-Ubuntu"

# Stop VM
Stop-VM -Name "VM-Ubuntu"

# List all VMs
Get-VM | Format-Table Name, State, CPUUsage, MemoryAssigned

# Connect to console
vmconnect.exe localhost "VM-Ubuntu"

Step 7 — Snapshots (checkpoints)

powershell
# Create snapshot
Checkpoint-VM -Name "VM-Ubuntu" -SnapshotName "Pre-update"

# List snapshots
Get-VMSnapshot -VMName "VM-Ubuntu"

# Restore snapshot
Restore-VMSnapshot -VMName "VM-Ubuntu" -Name "Pre-update" -Confirm:$false

# Delete snapshot
Remove-VMSnapshot -VMName "VM-Ubuntu" -Name "Pre-update"

Step 8 — Export and import VMs

powershell
# Export
Export-VM -Name "VM-Ubuntu" -Path "E:\Exports"

# Import
Import-VM -Path "E:\Exports\VM-Ubuntu\Virtual Machines\vm.vmcx" -Copy -GenerateNewId

Hyper-V on your Baires Host VPS lets you virtualize additional services with complete isolation.


Was this guide helpful?