Microsoft Hyper-V is a Type 1 hypervisor built into Windows Server and available as a free standalone product (Hyper-V Server). For organizations already invested in the Microsoft ecosystem, Hyper-V provides powerful virtualization with seamless Active Directory integration and PowerShell automation.
π₯ Free Hyper-V PowerShell Cheat Sheet
All essential Hyper-V PowerShell commands for VM management, networking, storage, and replication.
Download Free PDF βTable of Contents
- Hyper-V Overview
- Editions & Licensing
- Installation
- VM Management with PowerShell
- Virtual Networking
- Storage & VHD Management
- Checkpoints & Backup
- Replication & Live Migration
- Best Practices
Hyper-V Overview
Hyper-V uses a microkernel architecture where the hypervisor runs directly on hardware, and even the host Windows installation runs as a privileged "parent partition" on top of the hypervisor. This means Hyper-V is technically a Type 1 hypervisor despite appearing to run "within" Windows.
Key Specifications (Windows Server 2025)
| Specification | Maximum |
|---|---|
| VMs per host | 1,024 |
| vCPUs per VM | 240 |
| RAM per host | 24 TB |
| RAM per VM | 12 TB |
| Virtual disk (VHDX) | 64 TB |
| Virtual switch ports | Unlimited |
Editions & Licensing
- Windows Server Standard β Includes Hyper-V, 2 VM licenses per core license
- Windows Server Datacenter β Includes Hyper-V, unlimited VMs per host
- Hyper-V Server β Free standalone (discontinued after 2019, use Azure Stack HCI)
- Windows 10/11 Pro/Enterprise β Client Hyper-V for development/testing
Installation
# Enable Hyper-V role on Windows Server
Install-WindowsFeature -Name Hyper-V -IncludeManagementTools -Restart
# Enable on Windows 10/11
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
# Verify installation
Get-WindowsFeature Hyper-V
VM Management with PowerShell
# Create a new VM
New-VM -Name "WebServer" -MemoryStartupBytes 4GB -NewVHDPath "C:\VMs\WebServer.vhdx" -NewVHDSizeBytes 60GB -Generation 2
# Set VM properties
Set-VM -Name "WebServer" -ProcessorCount 4
Set-VMMemory -VMName "WebServer" -DynamicMemoryEnabled $true -MinimumBytes 2GB -MaximumBytes 8GB
# Add DVD drive with ISO
Add-VMDvdDrive -VMName "WebServer" -Path "C:\ISOs\ubuntu-22.04.iso"
# Power operations
Start-VM -Name "WebServer"
Stop-VM -Name "WebServer" # Graceful shutdown
Stop-VM -Name "WebServer" -Force # Force power off
Restart-VM -Name "WebServer"
Suspend-VM -Name "WebServer" # Pause
Resume-VM -Name "WebServer" # Resume
# List and monitor VMs
Get-VM
Get-VM | Select Name, State, CPUUsage, MemoryAssigned, Uptime
Get-VM | Where-Object { $_.State -eq 'Running' }
Virtual Networking
Hyper-V supports three types of virtual switches:
- External β Connected to a physical NIC, provides network access
- Internal β Communication between VMs and host, no physical network access
- Private β Communication between VMs only, isolated from host
# Create virtual switches
New-VMSwitch -Name "External" -NetAdapterName "Ethernet" -AllowManagementOS $true
New-VMSwitch -Name "Internal" -SwitchType Internal
New-VMSwitch -Name "Private" -SwitchType Private
# Manage VM network adapters
Add-VMNetworkAdapter -VMName "WebServer" -SwitchName "External"
Get-VMNetworkAdapter -VMName "WebServer"
Set-VMNetworkAdapterVlan -VMName "WebServer" -Access -VlanId 100
# List switches
Get-VMSwitch | Select Name, SwitchType, NetAdapterInterfaceDescription
Storage & VHD Management
# Create virtual hard disks
New-VHD -Path "C:\VMs\data.vhdx" -SizeBytes 100GB -Dynamic
New-VHD -Path "C:\VMs\data.vhdx" -SizeBytes 100GB -Fixed
# Manage VHDs
Get-VHD -Path "C:\VMs\data.vhdx"
Resize-VHD -Path "C:\VMs\data.vhdx" -SizeBytes 200GB
Convert-VHD -Path "old.vhd" -DestinationPath "new.vhdx"
Optimize-VHD -Path "C:\VMs\data.vhdx" -Mode Full
# Attach/detach disks
Add-VMHardDiskDrive -VMName "WebServer" -Path "C:\VMs\data.vhdx"
Remove-VMHardDiskDrive -VMName "WebServer" -ControllerType SCSI -ControllerNumber 0 -ControllerLocation 1
Checkpoints & Backup
# Checkpoints (snapshots)
Checkpoint-VM -Name "WebServer" -SnapshotName "Pre-Update"
Get-VMSnapshot -VMName "WebServer"
Restore-VMSnapshot -Name "Pre-Update" -VMName "WebServer" -Confirm:$false
Remove-VMSnapshot -VMName "WebServer" -Name "Pre-Update"
# Export/Import
Export-VM -Name "WebServer" -Path "D:\Exports"
Import-VM -Path "D:\Exports\WebServer\Virtual Machines\*.vmcx" -Copy
Replication & Live Migration
# Enable Hyper-V Replica
Enable-VMReplication -VMName "WebServer" -ReplicaServerName "Host2" -ReplicaServerPort 443 -AuthenticationType Certificate
# Start replication
Start-VMInitialReplication -VMName "WebServer"
# Check replication health
Get-VMReplication | Select VMName, State, Health, FrequencySec
# Live migration
Move-VM -Name "WebServer" -DestinationHost "Host2" -IncludeStorage -DestinationStoragePath "D:\VMs"
# Storage-only migration
Move-VMStorage -VMName "WebServer" -DestinationStoragePath "D:\NewStorage"
Best Practices
- Use Generation 2 VMs β Better performance, UEFI boot, Secure Boot support
- Enable Dynamic Memory β Allows Hyper-V to allocate RAM based on actual demand
- Use VHDX over VHD β VHDX supports up to 64 TB, better corruption recovery
- Install Integration Services β Enhances performance and management capabilities
- Separate management network β Use a dedicated NIC for Hyper-V management
- Regular checkpoints before updates β But don't rely on them for long-term backups
- Use Failover Clustering for HA β Automatic VM failover between cluster nodes
- Monitor with Windows Admin Center β Modern web-based management for Hyper-V
π₯ Download the Hyper-V Cheat Sheet
All essential PowerShell commands for Hyper-V in a printable PDF.
Download Free PDF β