Home / Server / Windows Server / How to Manage Hyper-V on Windows Server

How to Manage Hyper-V on Windows Server

Hyper-V on Windows Server is a full enterprise virtualisation platform — capable of running dozens of virtual machines, live migration, clustering, and replication. Managing Hyper-V beyond the basics requires understanding virtual switches, storage configuration, VM settings, and how to use PowerShell for automation. This guide covers the essential Hyper-V management tasks on Windows Server.

Install Hyper-V on Windows Server

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

Or via Server Manager → Add Roles and Features → Hyper-V. A restart is required. After installation, Hyper-V Manager is available under Server Manager → Tools, or by running virtmgmt.msc.

Plan Your Virtual Switch Configuration

Virtual switches determine how VMs connect to networks. Plan this before creating VMs — changing a VM’s switch later can cause a brief network interruption.

# List existing virtual switches
Get-VMSwitch | Select-Object Name, SwitchType, NetAdapterInterfaceDescription

# Create an External switch (VMs get full network access)
New-VMSwitch -Name "External Switch" -NetAdapterName "Ethernet" -AllowManagementOS $true

# Create an Internal switch (VMs can talk to host but not external network)
New-VMSwitch -Name "Internal Switch" -SwitchType Internal

# Create a Private switch (VMs can only communicate with each other)
New-VMSwitch -Name "Private Switch" -SwitchType Private

The -AllowManagementOS $true flag on an External switch means the host server also uses that switch for its network connectivity — standard for single-NIC servers. On servers with dedicated NICs for management and VM traffic, set this to $false.

Create a Virtual Machine via PowerShell

# Create a Generation 2 VM with 4GB RAM and a 60GB virtual hard disk
New-VM -Name "WebServer01" -Generation 2 -MemoryStartupBytes 4GB -NewVHDPath "D:\VMs\WebServer01.vhdx" -NewVHDSizeBytes 60GB -SwitchName "External Switch"

# Assign a processor count
Set-VMProcessor -VMName "WebServer01" -Count 2

# Add a DVD drive for OS installation
Add-VMDvdDrive -VMName "WebServer01"
Set-VMDvdDrive -VMName "WebServer01" -Path "C:\ISO\WinServer2022.iso"

# Enable Dynamic Memory
Set-VMMemory -VMName "WebServer01" -DynamicMemoryEnabled $true -MinimumBytes 1GB -MaximumBytes 8GB -StartupBytes 4GB

# Start the VM
Start-VM -Name "WebServer01"

List and Monitor Running VMs

# List all VMs and their current state
Get-VM | Select-Object Name, State, CPUUsage, MemoryAssigned, Uptime

# Get detailed VM info
Get-VM -Name "WebServer01" | Select-Object *

# Monitor VM resource usage in real time (updates every 2 seconds)
while ($true) {
    Get-VM | Select-Object Name, CPUUsage, @{N='Mem_GB';E={[math]::Round($_.MemoryAssigned/1GB,1)}}, State
    Start-Sleep 2
    Clear-Host
}

Manage VM Snapshots (Checkpoints)

Checkpoints capture the complete state of a VM at a point in time — useful before risky changes like patching or software installations:

# Create a checkpoint
Checkpoint-VM -Name "WebServer01" -SnapshotName "Before April Patches"

# List checkpoints for a VM
Get-VMSnapshot -VMName "WebServer01"

# Restore to a checkpoint
Restore-VMSnapshot -VMName "WebServer01" -Name "Before April Patches" -Confirm:$false

# Delete a checkpoint (once you are sure the change is good)
Remove-VMSnapshot -VMName "WebServer01" -Name "Before April Patches"

Important: do not leave checkpoints in place indefinitely. Each checkpoint creates a differencing disk that grows over time and can cause performance issues. Create them before changes, test, then either restore or delete.

Configure VM Hard Disk Storage

# Add a second virtual disk to a VM
New-VHD -Path "D:\VMs\WebServer01-Data.vhdx" -SizeBytes 200GB -Dynamic
Add-VMHardDiskDrive -VMName "WebServer01" -Path "D:\VMs\WebServer01-Data.vhdx"

# Expand an existing VHD (VM must be off or disk must be offline inside VM)
Resize-VHD -Path "D:\VMs\WebServer01.vhdx" -SizeBytes 100GB

# Convert a dynamic VHD to fixed (better performance for production)
Convert-VHD -Path "D:\VMs\WebServer01.vhdx" -DestinationPath "D:\VMs\WebServer01-Fixed.vhdx" -VHDType Fixed

Live Migration — Move a Running VM

Hyper-V Live Migration moves a running VM from one host to another with no downtime (requires Hyper-V hosts in a failover cluster, or shared storage between hosts):

# Move a running VM to another host (requires appropriate setup)
Move-VM -Name "WebServer01" -DestinationHost "HYPERVHOST02" -IncludeStorage -DestinationStoragePath "D:\VMs"

For environments without clustering, a standard migration (VM briefly paused during transfer) can be done with -AllowUnverifiedPaths.

Hyper-V Replication

Hyper-V Replica asynchronously copies VMs to a secondary host — providing a disaster recovery target without shared storage:

# Enable replication on the primary host (set it as a replication source)
Enable-VMReplication -VMName "WebServer01" -ReplicaServerName "DR-HOST" -ReplicaServerPort 80 -AuthenticationType Kerberos -ReplicationFrequencySec 300

# Start initial replication
Start-VMInitialReplication -VMName "WebServer01"

# Check replication health
Get-VMReplication | Select-Object VMName, State, Health, LastReplicationTime

Key Hyper-V Performance Tips

  • Store VHDx files on separate physical disks from the OS — VM storage on C: competes with the host OS for disk I/O
  • Use fixed-size VHDs for production VMs — dynamic disks have slightly worse performance and can cause unexpected disk full conditions on the host
  • Set memory limits — without a Maximum Memory setting on dynamic memory, a single VM can consume all host RAM
  • Enable Enhanced Session Mode — better console experience for Windows guest VMs (clipboard, audio, resizable window)
  • Keep Hyper-V Integration Services up to date inside guest VMs — these provide performance-optimised drivers for storage and network

Sign Up For Daily Newsletter

Stay updated with our weekly newsletter. Subscribe now to never miss an update!

[mc4wp_form]

Leave a Reply

Your email address will not be published. Required fields are marked *