Hyper-V
Updated: September 10, 2025Categories: Virtualization, Bare Metal
Printed from:
Microsoft Hyper-V Comprehensive Cheatsheet
1. Installation and Role Configuration
Windows Server
PowerShell
123456# Install Hyper-V Role via PowerShell Install-WindowsFeature -Name Hyper-V -IncludeManagementTools -Restart # Verify installation Get-WindowsFeature *Hyper-V*
Windows 10/11 Pro
- Settings > Apps > Programs and Features > Turn Windows features on or off
- Check "Hyper-V" checkbox
- Restart computer
2. Hyper-V Manager Interface
Key Navigation
- Server Manager > Tools > Hyper-V Manager
- Right-click local/remote server to manage
- Actions panel for core operations
- Virtual Machines view shows current state
3. Virtual Machine Creation and Configuration
GUI Method
- Open Hyper-V Manager
- Actions > New > Virtual Machine
- Configuration steps:
- Name and location
- Generation selection (Gen 1 or Gen 2)
- Memory configuration
- Network connection
- Virtual hard disk setup
- OS installation method
PowerShell VM Creation
PowerShell
1234567# Create new VM New-VM -Name "ServerName" -MemoryStartupBytes 4GB -Generation 2 # Configure VM settings Set-VM -Name "ServerName" -ProcessorCount 4 Set-VMMemory -VMName "ServerName" -DynamicMemoryEnabled $true
4. Virtual Hard Disk Management
VHD/VHDX Operations
PowerShell
123456789# Create new VHDX New-VHD -Path C:\VMs\disk1.vhdx -SizeBytes 100GB -Dynamic # Attach disk to VM Add-VMHardDiskDrive -VMName "ServerName" -Path C:\VMs\disk1.vhdx # Inspect VHD details Get-VHD -Path C:\VMs\disk1.vhdx
5. Virtual Networking
Virtual Switch Types
- External: Direct physical network connection
- Internal: Communication between VMs and host
- Private: VM-to-VM communication only
PowerShell
123456# Create external virtual switch New-VMSwitch -Name "ExternalSwitch" -NetAdapterName "Ethernet" -AllowManagementOS $true # Configure NAT New-NetNat -Name "InternalNAT" -InternalIPInterfaceAddressPrefix 192.168.0.0/24
6. Checkpoints and Snapshots
PowerShell
123456789# Create checkpoint Checkpoint-VM -Name "ServerName" # List checkpoints Get-VMSnapshot -VMName "ServerName" # Restore to specific checkpoint Restore-VMSnapshot -Name "CheckpointName" -VMName "ServerName"
7. Live Migration Setup
Prerequisites
- Windows Server failover clustering
- Shared storage
- Constrained delegation configuration
PowerShell
123456# Enable live migration Enable-VMMigration # Configure migration networks Set-VMMigrationNetwork -IPv4Subnet "192.168.1.0/24"
8. Resource Allocation and Performance
VM Resource Configuration
PowerShell
123456# Set CPU priority Set-VMProcessor -VMName "ServerName" -Reserve 10 -RelativeWeight 200 # Memory management Set-VMMemory -VMName "ServerName" -DynamicMemoryEnabled $true -MinimumBytes 1GB -MaximumBytes 8GB
9. Integration Services
Management
PowerShell
123456# List integration services Get-VMIntegrationService -VMName "ServerName" # Enable/Disable specific service Enable-VMIntegrationService -Name "Heartbeat" -VMName "ServerName"
10. Security Features
Secure Boot Configuration
PowerShell
123# Enable Secure Boot for Generation 2 VMs Set-VMFirmware -VMName "ServerName" -EnableSecureBoot On
11. PowerShell Automation Cmdlets
Essential Cmdlets
New-VMStart-VMStop-VMRestart-VMGet-VMSet-VMMove-VM
12. Failover Clustering
Configuration Steps
- Install Failover Clustering feature
- Create cluster
- Add Hyper-V hosts
- Configure cluster shared volumes (CSV)
PowerShell
123# Install failover clustering Install-WindowsFeature Failover-Clustering -IncludeManagementTools
13. Backup and Disaster Recovery
Recommended Strategies
- Windows Server Backup
- System Center Virtual Machine Manager
- Third-party backup solutions
- Regular checkpoint/snapshot management
14. Troubleshooting and Monitoring
Common Diagnostic Commands
PowerShell
123456# Check Hyper-V service Get-Service vmms # Event log analysis Get-WinEvent -LogName "Microsoft-Windows-Hyper-V-*"
15. Best Practices
Performance and Reliability
- Use Generation 2 VMs
- Enable dynamic memory
- Use fixed-size VHDx
- Separate management and VM traffic
- Regular Windows Updates
- Monitor resource utilization
Security Recommendations
- Use Secure Boot
- Enable TPM for sensitive VMs
- Implement network isolation
- Regularly update integration services
- Use shielded VMs for critical workloads
Note: Always test configurations in staging before production deployment.
Continue Learning
Discover more cheatsheets to boost your productivity