Hyper-V Commands
Microsoft Hyper-V PowerShell cmdlets for hypervisor management.
Host Startup Procedure
Step 1: Power on physical hostBoot the Hyper-V server hardware
Step 2: Wait for host bootWait for Windows Server to fully boot (3-5 minutes)
Get-Service vmmsCheck Hyper-V Virtual Machine Management service status
Start-Service vmmsStart Hyper-V service if not running
Get-VMList all VMs and their states
Step 3: Start VMs with auto-startVMs configured with automatic start will boot automatically
Get-VM | Where-Object {$_.State -eq "Off" -and $_.AutomaticStartAction -ne "Nothing"}List VMs configured for auto-start
Step 4: Manually start remaining VMsStart VMs that require manual intervention
VM Management
Get-VMList all virtual machines
Get-VM -Name <VMName>Get specific VM details
New-VM -Name <VMName> -MemoryStartupBytes <Bytes> -Generation 2Create new Generation 2 VM
Start-VM -Name <VMName>Start a VM
Stop-VM -Name <VMName>Gracefully shutdown VM
Stop-VM -Name <VMName> -TurnOffForce power off VM
Restart-VM -Name <VMName>Restart VM
Suspend-VM -Name <VMName>Pause VM
Resume-VM -Name <VMName>Resume paused VM
Save-VM -Name <VMName>Save VM state
Remove-VM -Name <VMName>Delete VM (keeps VHD files)
Remove-VM -Name <VMName> -ForceForce delete VM without confirmation
Set-VM -Name <VMName> -ProcessorCount <Count>Set CPU count
Set-VM -Name <VMName> -MemoryStartupBytes <Bytes>Set startup memory
Set-VM -Name <VMName> -DynamicMemoryEnable dynamic memory
Set-VM -Name <VMName> -AutomaticStartAction StartEnable automatic start
Set-VM -Name <VMName> -AutomaticStopAction ShutDownSet shutdown action on host stop
Virtual Disk Management
Get-VHD -Path <Path>Display VHD/VHDX information
New-VHD -Path <Path> -SizeBytes <Bytes> -DynamicCreate dynamic VHD
New-VHD -Path <Path> -SizeBytes <Bytes> -FixedCreate fixed VHD
Resize-VHD -Path <Path> -SizeBytes <Bytes>Resize VHD
Convert-VHD -Path <Source> -DestinationPath <Dest>Convert VHD format
Test-VHD -Path <Path>Verify VHD integrity
Optimize-VHD -Path <Path> -Mode FullCompact VHD
Add-VMHardDiskDrive -VMName <VMName> -Path <Path>Attach VHD to VM
Remove-VMHardDiskDrive -VMName <VMName> -ControllerType SCSI -ControllerNumber 0 -ControllerLocation 1Remove disk from VM
Get-VMHardDiskDrive -VMName <VMName>List VM disks
Network Management
Get-VMSwitchList all virtual switches
New-VMSwitch -Name <Name> -NetAdapterName <Adapter> -AllowManagementOS $trueCreate external vSwitch with management access
New-VMSwitch -Name <Name> -SwitchType InternalCreate internal vSwitch
New-VMSwitch -Name <Name> -SwitchType PrivateCreate private vSwitch
Remove-VMSwitch -Name <Name>Delete virtual switch
Get-VMNetworkAdapter -VMName <VMName>List VM network adapters
Add-VMNetworkAdapter -VMName <VMName> -SwitchName <Switch>Add network adapter to VM
Remove-VMNetworkAdapter -VMName <VMName> -Name <AdapterName>Remove network adapter
Set-VMNetworkAdapter -VMName <VMName> -StaticMacAddress <MAC>Set static MAC address
Set-VMNetworkAdapterVlan -VMName <VMName> -Access -VlanId <ID>Set VLAN for adapter
Get-VMNetworkAdapterVlan -VMName <VMName>Display VLAN configuration
Checkpoint Management
Get-VMCheckpoint -VMName <VMName>List VM checkpoints
Checkpoint-VM -Name <VMName> -SnapshotName <Name>Create checkpoint
Restore-VMCheckpoint -VMName <VMName> -Name <Checkpoint>Restore checkpoint
Remove-VMCheckpoint -VMName <VMName> -Name <Checkpoint>Delete checkpoint
Export-VMCheckpoint -VMName <VMName> -Name <Checkpoint> -Path <Path>Export checkpoint
Set-VM -Name <VMName> -CheckpointType ProductionEnable production checkpoints
Set-VM -Name <VMName> -CheckpointType StandardEnable standard checkpoints
Replication & Backup
Enable-VMReplication -VMName <VMName> -ReplicaServerName <Server> -AuthenticationType KerberosEnable VM replication
Start-VMInitialReplication -VMName <VMName>Start initial replication
Get-VMReplication -VMName <VMName>Display replication status
Start-VMFailover -VMName <VMName> -PreparePrepare for planned failover
Start-VMFailover -VMName <VMName>Perform failover
Export-VM -Name <VMName> -Path <Path>Export VM
Import-VM -Path <Path>Import VM
Compare-VM -Path <Path>Validate VM for import
Host Configuration
Get-VMHostDisplay Hyper-V host information
Set-VMHost -VirtualHardDiskPath <Path>Set default VHD path
Set-VMHost -VirtualMachinePath <Path>Set default VM path
Get-VMHostNumaNodeDisplay NUMA topology
Get-VMHostSupportedVersionList supported VM versions
Enable-VMResourceMetering -VMName <VMName>Enable resource metering
Measure-VM -VMName <VMName>Display resource usage metrics
Test-VmNetworkAdapter -VMName <VMName> -SenderTest network adapter connectivity
Cluster Management
Get-ClusterNodeList cluster nodes
Get-ClusterResourceList cluster resources
Get-ClusterGroupList cluster groups
Move-ClusterVirtualMachineRole -Name <VMName> -Node <Node>Live migrate VM to another node
Add-ClusterVirtualMachineRole -VirtualMachine <VMName>Make VM highly available
Get-ClusterSharedVolumeList cluster shared volumes
Test-ClusterRun cluster validation tests
Monitoring & Troubleshooting
Get-VM | Select Name, State, CPUUsage, MemoryAssignedDisplay VM resource usage
Get-VMMemory -VMName <VMName>Display VM memory configuration
Get-VMProcessor -VMName <VMName>Display VM processor configuration
Get-VMIntegrationService -VMName <VMName>Display integration services status
Enable-VMIntegrationService -VMName <VMName> -Name <Service>Enable integration service
Get-VMReplicationHealth -VMName <VMName>Check replication health
Get-VMResourcePoolList resource pools
Get-Counter -Counter "Hyper-V Hypervisor Logical Processor(*)% Total Run Time"Monitor hypervisor CPU usage
Get-EventLog -LogName "Microsoft-Windows-Hyper-V-VMMS-Admin" -Newest 50View Hyper-V event logs