Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Hyper-V GPU-P Setup

Interactive PowerShell script to configure GPU Partitioning (GPU-P) on a Hyper-V Windows guest VM and copy GPU drivers from the host into the VM disk.

Supports AMD and NVIDIA.

What it does

  1. Prompts for GPU vendor (AMD or NVIDIA).
  2. Lists Hyper-V VMs and prompts for selection.
  3. Shuts down the VM if it is running.
  4. Configures the GPU-P adapter and mapped memory settings.
  5. Mounts the VM disk on the host.
  6. Copies vendor driver packages from the host DriverStore to the guest HostDriverStore.
  7. Dismounts the disk and starts the VM.

Requirements

  • Windows with Hyper-V enabled
  • PowerShell run as Administrator
  • GPU with GPU-P support on the host
  • Vendor drivers installed on the host (C:\Windows\System32\DriverStore\FileRepository)
  • An existing Windows guest VM in Hyper-V

Usage

Open PowerShell as Administrator and run:

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
.\setup-gpup.ps1

Follow the prompts to select vendor and VM.

Expected output

GPU Vendor:

[1] AMD
[2] NVIDIA

Select vendor: 1

Virtual Machines:

[1] MyVM [Off]

Select VM: 1

Selected: MyVM (AMD)
Finding guest disk...
Guest disk: D:\Hyper-V\MyVM\Virtual Hard Disks\disk.vhdx
Configuring GPU-P...
Mounting guest disk...
Guest Windows: E:
Copying 3 AMD driver packages...
  ...
Dismounting guest disk...
Starting VM...

GPU-P setup completed successfully.
MyVM is running.

VM settings applied

Setting Value
GPU partition adapter Added (replaces existing adapter if present)
GuestControlledCacheTypes $true
LowMemoryMappedIoSpace 1 GB
HighMemoryMappedIoSpace 32 GB
Automatic checkpoints Disabled

Drivers copied

Host DriverStore folders are copied to:

<guest-drive>:\Windows\System32\HostDriverStore\FileRepository
Vendor Folder name filter
AMD amd, ati, radeon
NVIDIA nvidia, nv_disp, nv_dispi, nvhda, nvlt

Install the correct GPU drivers on the host before running the script.

Error handling

  • If setup fails, the VM is not started.
  • The VM disk is dismounted in the finally block, even on error.
  • If the disk is still mounted after setup, the script exits before starting the VM.

Limitations

  • Windows guest VMs only.
  • Uses the first valid virtual disk on the VM (sorted by controller).
  • The VM must be off while drivers are copied.
  • NVIDIA GPU-P may require additional host setup (vGPU stack) beyond driver copy.
  • Checkpoints are not supported on VMs with a GPU partition adapter. The script disables automatic checkpoints during setup.

Troubleshooting

Error Likely cause
No virtual machines found No VMs in Hyper-V
No valid virtual hard disk found VM has no valid VHD/VHDX
Windows partition not found No drive letter on the Windows partition after mount
No AMD/NVIDIA driver packages found on the host Drivers not installed on the host
Failed to dismount guest disk Disk still in use; close programs accessing the VHD
Failed to start VM GPU-P not supported or configuration incomplete
Checkpoint operation failed / Checkpoints have been disabled GPU-P VMs cannot use checkpoints; re-run the script or run Set-VM -Name <vm> -AutomaticCheckpointsEnabled $false

Warnings

  • Run only on VMs you own and control.
  • Back up the VHD/VHDX before the first run.
  • The script force-stops the VM if it is running.

About

Set up Hyper-V GPU Partitioning and copy GPU drivers into a Windows guest VM.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages