Hyper-V
Install the role
powershell
# Windows Server (Desktop or Core)
Install-WindowsFeature -Name Hyper-V -IncludeManagementTools -Restart
# Windows 10/11 Pro or Enterprise (admin PC, management tools only)
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Tools-All -AllManage a host remotely from Windows 11
Domain-joined host: open Hyper-V Manager → Connect to Server → host name. That is all.
Workgroup host (Microsoft's documented method). On the host:
powershell
Enable-PSRemoting
Enable-WSManCredSSP -Role ServerOn the admin PC, as administrator:
powershell
Set-Item WSMan:\localhost\Client\TrustedHosts -Value "hv01" -Concatenate -Force
Enable-WSManCredSSP -Role Client -DelegateComputer "hv01"Then in gpedit.msc on the admin PC: Computer Configuration → Administrative Templates → System → Credentials Delegation → Allow delegating fresh credentials with NTLM-only server authentication. Enable it and add wsman/hv01. Connect in Hyper-V Manager with Connect as another user and the host's hv01\Administrator.
The host name must resolve from the admin PC. Add it to hosts if there is no DNS for it.
Virtual switches
powershell
Get-NetAdapter
# External: VMs on the LAN, host keeps using the NIC too
New-VMSwitch -Name "LAN" -NetAdapterName "Ethernet" -AllowManagementOS $true
# Internal: host and VMs only
New-VMSwitch -Name "Lab" -SwitchType InternalCreating an external switch drops the host's network for a few seconds. Do it from the console, or expect a brief RDP drop.
Everyday VM PowerShell
powershell
Get-VM
Start-VM -Name "APP01"
Stop-VM -Name "APP01" # graceful shutdown; -TurnOff to pull the plug
# New Generation 2 VM
New-VM -Name "APP02" -Generation 2 -MemoryStartupBytes 4GB `
-NewVHDPath "D:\Hyper-V\APP02.vhdx" -NewVHDSizeBytes 80GB -SwitchName "LAN"
Set-VMProcessor -VMName "APP02" -Count 4
Set-VMMemory -VMName "APP02" -DynamicMemoryEnabled $true -MinimumBytes 2GB -MaximumBytes 8GB
Add-VMDvdDrive -VMName "APP02" -Path "D:\ISO\server2025.iso"
Set-VMFirmware -VMName "APP02" -FirstBootDevice (Get-VMDvdDrive -VMName "APP02")
# Checkpoints
Checkpoint-VM -Name "APP01" -SnapshotName "Before update"
Get-VMSnapshot -VMName "APP01"
Remove-VMSnapshot -VMName "APP01" -Name "Before update"
# Copy a file into a running VM (needs Guest Service Interface)
Enable-VMIntegrationService -VMName "APP01" -Name "Guest Service Interface"
Copy-VMFile -Name "APP01" -SourcePath "C:\temp\tool.zip" -DestinationPath "C:\temp\" -FileSource Host -CreateFullPath
# Nested virtualization (VM must be off)
Set-VMProcessor -VMName "LAB01" -ExposeVirtualizationExtensions $true
# Export / import
Export-VM -Name "APP01" -Path "E:\Export"Good habits
- Checkpoints are not backups. They live on the same disk and slow the VM the longer they exist. Delete them once the change is confirmed.
- Use Generation 2 VMs unless the guest OS cannot boot UEFI.
- Do not give a VM more virtual CPUs than the host has physical cores.
- Keep VM files off the C: drive of the host.
Further reading
- Remotely manage Hyper-V hosts (Microsoft)