Share GPU with Hyper-V VMs: Easy Steps, No Software Needed!

Updated on Mar 21,2024

Share GPU with Hyper-V VMs: Easy Steps, No Software Needed!

Table of Contents

  1. Introduction
  2. Problem Statement
  3. GPU Sharing with Hyperv Virtual Machines
  4. Step 1: Shutting Down the VM
  5. Step 2: Locating the Driver Files
  6. Step 3: Copying the Driver Files to the VM
  7. Step 4: Assigning the GPU to the VM
  8. Step 5: Ejecting the Mounted Drive
  9. Step 6: Running the PowerShell Script
  10. Step 7: Confirming the GPU Assignment
  11. Conclusion

GPU Sharing with Hyperv Virtual Machines

In this article, we will discuss the procedure for sharing a GPU with multiple Hyperv virtual machines. Many users have encountered the issue of not being able to utilize their GPU in a virtual machine, as it only recognizes virtual display adapters. However, with GPU partitioning, we can overcome this limitation and assign the GPU to the desired virtual machine. Follow the steps below to share your GPU effectively.

Step 1: Shutting Down the VM

Before proceeding with the GPU sharing process, ensure that the virtual machine in question is powered off and has no active snapshots. This is crucial for the following procedure to work successfully.

Step 2: Locating the Driver Files

On the Windows Hyperv host, navigate to the "Windows\system32\driverstore" folder. Here, you will find the driver files necessary for the GPU sharing process. Copy the complete "file repository" folder from the host PC.

Step 3: Copying the Driver Files to the VM

Mount the virtual hard drive for the VM you want to assign the GPU to. Once mounted, browse to the "Windows\system32" folder on the virtual machine. Create a new folder called "host_driver_store" and enter this folder. Paste the "file repository" folder that was copied earlier into this newly created folder. For Nvidia GPU users, an additional step is required. Copy all files starting with "env" from the host "system32" folder and paste them into the same location on the VM's drive.

Step 4: Assigning the GPU to the VM

Open PowerShell in administrator mode and execute the provided PowerShell script. Replace the placeholder with the name of the VM you want to assign the GPU to. This script will assign the GPU to the specified virtual machine.

Step 5: Ejecting the Mounted Drive

After successfully running the PowerShell script, eject the mounted drive from the virtual machine.

Step 6: Running the PowerShell Script

Open PowerShell in administrator mode and execute the provided PowerShell script. Replace the placeholder with the name of the VM you want to assign the GPU to. This script will assign the GPU to the specified virtual machine.

Step 7: Confirming the GPU Assignment

Start up the virtual machine again and open the device manager. Confirm that the GPU is now being shared with the virtual machine by checking under "Display Adapters." Ensure that there are no exclamation marks next to the GPU, indicating missing drivers.

By following these steps, you should be able to successfully share your GPU with a Hyperv virtual machine. This will allow you to utilize the GPU for graphical workloads within the virtual environment. Enjoy enhanced performance and flexibility with GPU sharing.

Conclusion

In conclusion, GPU sharing with Hyperv virtual machines provides a solution for utilizing GPUs in virtual environments. By following the step-by-step procedure outlined in this article, you can effectively share your GPU and enable graphical workloads within your virtual machines. Enjoy increased performance and flexibility in your virtualized setup with shared GPU resources.

🔍 Pros:

  • Enables GPU utilization in virtual machines
  • Enhanced performance for graphical workloads
  • Flexible resource allocation in virtual environments

⚠️ Cons:

  • Requires proper driver installations and configurations
  • Certain GPUs may require additional steps for Nvidia users

Remember to give this video a thumbs up or subscribe to our Channel if you found value in this content. Stay tuned for more technology videos in the future!

Most people like