How to Configure GPU Passthrough in Hyper-V on Windows Server 2025
Windows Server 2025 brings significant improvements to GPU virtualisation in Hyper-V. Where earlier releases relied exclusively on Discrete Device Assignment (DDA) to expose a physical GPU to a virtual machine, Windows Server 2025 introduces first-class support for GPU Partitioning (GPU-P), allowing a single physical GPU to be sliced into multiple partitions and shared across several VMs simultaneously. This makes GPU resources far more cost-effective for workloads such as AI and machine learning inference, hardware-accelerated video encoding, and remote desktop graphics rendering. This tutorial walks through both GPU-P and DDA, explains when to use each, and provides step-by-step PowerShell instructions for configuring GPU passthrough on Windows Server 2025.
Prerequisites
- Windows Server 2025 installed on a physical host with Hyper-V role enabled.
- A GPU that supports GPU Partitioning (NVIDIA RTX/A-series or AMD with GPU-P driver support) or any PCIe GPU supported by DDA.
- The target VM is Generation 2 and not using Secure Boot with a GPU-P configuration (disable Secure Boot or use a signed driver).
- Latest GPU drivers installed on the Hyper-V host.
- PowerShell running as Administrator on the host.
- The VM should be powered off before making GPU assignment changes.
Step 1: Check GPU-P Compatibility on the Host
Before assigning GPU resources, confirm that the host GPU supports partitioning. The Get-VMHostPartitionableGpu cmdlet returns details about any GPU-P-capable adapters on the system.
# List all partitionable GPUs on the host
Get-VMHostPartitionableGpu
# Detailed view of partition limits
Get-VMHostPartitionableGpu | Select-Object Name, ValidPartitionCounts, TotalPartitionCount
If the command returns one or more entries, the GPU supports GPU-P. A blank result means your GPU either does not support partitioning or the correct drivers are not installed. In that case, proceed to the DDA section (Step 5).
Step 2: Add a GPU Partition Adapter to the VM
With a compatible GPU confirmed, assign a GPU partition to a Generation 2 virtual machine. The VM must be shut down. Replace MyAIVM with the name of your target VM.
$VMName = "MyAIVM"
# Add a GPU partition adapter to the VM
Add-VMGpuPartitionAdapter -VMName $VMName
# Verify the adapter was added
Get-VMGpuPartitionAdapter -VMName $VMName
By default, Hyper-V assigns equal resource fractions. You can add multiple adapters if the GPU supports enough partitions, but one adapter per VM is most common for AI/ML workloads.
Step 3: Configure GPU Partition Resource Fractions
GPU-P exposes five resource types: VRAM, Encode, Decode, Compute, and GfxPartition. Each is expressed as a fraction of 100,000,000 (one hundred million units = 100%). For a VM that should receive 50% of each resource:
$VMName = "MyAIVM"
$Fraction = 50000000 # 50% of 100,000,000
Set-VMGpuPartitionAdapter -VMName $VMName `
-MinPartitionVRAM $Fraction `
-MaxPartitionVRAM $Fraction `
-OptimalPartitionVRAM $Fraction `
-MinPartitionEncode $Fraction `
-MaxPartitionEncode $Fraction `
-OptimalPartitionEncode $Fraction `
-MinPartitionDecode $Fraction `
-MaxPartitionDecode $Fraction `
-OptimalPartitionDecode $Fraction `
-MinPartitionCompute $Fraction `
-MaxPartitionCompute $Fraction `
-OptimalPartitionCompute $Fraction
# Confirm settings
Get-VMGpuPartitionAdapter -VMName $VMName | Format-List
Adjust the fraction values to suit the number of VMs sharing the GPU. Two VMs each receiving 50% saturates the GPU; three VMs at 33% leaves a small buffer for the host.
Step 4: Enable GPU-P Support Flags and Start the VM
GPU-P on Windows Server 2025 also requires enabling automatic checkpoints to be disabled (GPU-P is incompatible with checkpoints) and setting the GuestControlledCacheTypes flag.
$VMName = "MyAIVM"
# Disable automatic checkpoints (required for GPU-P)
Set-VM -VMName $VMName -AutomaticCheckpointsEnabled $false
# Enable cache type control (required by GPU-P driver stack)
Set-VM -VMName $VMName -GuestControlledCacheTypes $true -LowMemoryMappedIoSpace 1GB -HighMemoryMappedIoSpace 32GB
# Start the VM
Start-VM -VMName $VMName
Step 5: Install GPU Drivers Inside the VM
Inside the guest VM, Windows will detect the partitioned GPU but requires the correct GPU driver. For NVIDIA GPUs, download the GRID or vGPU driver package from the NVIDIA Licensing Portal. For AMD, use the ROCm or Radeon Pro driver. After installation, verify GPU recognition:
# Run inside the guest VM
Get-PnpDevice | Where-Object { $_.Class -eq "Display" }
# Check NVIDIA GPU (if applicable)
nvidia-smi
Step 6: Using Discrete Device Assignment (DDA) for Older GPUs
If your GPU does not support GPU-P, use DDA to assign the entire GPU to a single VM. First, dismount the GPU from the host, then assign it using its location path.
# Find the GPU location path
$GPU = Get-PnpDevice | Where-Object { $_.Class -eq "Display" }
$LocationPath = ($GPU | Get-PnpDeviceProperty -KeyName DEVPKEY_Device_LocationPaths).Data[0]
# Disable the device on the host
Disable-PnpDevice -InstanceId $GPU.InstanceId -Confirm:$false
# Dismount the device from the host OS
Dismount-VMHostAssignableDevice -LocationPath $LocationPath -Force
# Assign to VM (VM must be off)
$VMName = "MyDDAVM"
Add-VMAssignableDevice -VMName $VMName -LocationPath $LocationPath
# Set MMIO space (adjust based on GPU VRAM)
Set-VM -VMName $VMName -LowMemoryMappedIoSpace 1GB -HighMemoryMappedIoSpace 32GB
Start-VM -VMName $VMName
Step 7: GPU-P in Azure Stack HCI
Azure Stack HCI 23H2 and later (which shares the Windows Server 2025 kernel) supports GPU-P natively through Windows Admin Center and PowerShell. The cmdlets are identical to those above. GPU-P is particularly valuable in HCI scenarios because a single expensive GPU can serve multiple VMs across the cluster, with live migration support (GPU-P supports live migration; DDA does not).
# On an Azure Stack HCI node — check cluster-wide GPU-P resources
Get-ClusterNode | ForEach-Object {
Invoke-Command -ComputerName $_.Name -ScriptBlock {
Get-VMHostPartitionableGpu | Select-Object Name, TotalPartitionCount
}
}
Conclusion
GPU Partitioning in Windows Server 2025 and Hyper-V represents a major step forward for virtualised GPU workloads. By allowing a single physical GPU to be shared safely across multiple VMs, GPU-P reduces per-VM GPU costs for AI inference pipelines, video encoding farms, and GPU-accelerated remote desktops. DDA remains the correct choice when you need the full GPU dedicated to one VM, such as for training workloads or applications that require exclusive GPU access. With the PowerShell cmdlets covered in this tutorial, you can configure either approach systematically and repeatably across your Hyper-V fleet.