Vishal Ramkissoon
Software Engineer / ArchitectSetting Up a Windows to Windows Hyper V Virtual Machine With GPU P
Software Required
- Parsec - https://parsec.app/
- ParsecVDisplay - https://github.com/nomi-san/parsec-vdd
- VB-Audio - https://vb-audio.com/Cable/
Scripts
The following script should be saved and run from Windows Powershell ISE with administrator privileges.
$vm = "VM3"
if (Get-VMGpuPartitionAdapter -VMName $vm -ErrorAction SilentlyContinue) {
Remove-VMGpuPartitionAdapter -VMName $vm
}
Set-VM -GuestControlledCacheTypes $true -VMName $vm
Set-VM -LowMemoryMappedIoSpace 1Gb -VMName $vm
Set-VM -HighMemoryMappedIoSpace 32Gb -VMName $vm
Add-VMGpuPartitionAdapter -VMName $vm
Files Required From Host Machine
DriverStore Driver Files
The following files will need to be sourced from the Windows\System32\DriverStore\FileReponsitory folder under your Host Machine.
These files should then be copied into your Virtual machine and placed under the folder Windows\System32\HostDriverStore\FileRepository.
| File Name |
|---|
| nvhda.inf_amd64_7ddfa6f9e56e3d41 |
| nvhda.inf_amd64_c902843a0fd5ba00 |
| nvpcf.inf_amd64_69c6215d2d3e853b |
| nvppc.inf_amd64_5465f77a9a8448b4 |
| nvraid.inf_amd64_144351277838b429 |
| nvvad.inf_amd64_35079c3b2e98dd66 |
| nv_dispi.inf_amd64_7840b4313191ae17 |
| nv_dispig.inf_amd64_0afec3f2050014a0 |
NB: These files may or may not change between driver updates. These should only be taken as an example of the kind of files to look for. But typically these are the folders to copy
System32 Driver Files
The following files you will need from the Host machine are as follows. These files can be found under the Windows\System32 folder. These will be under the root of the folder as individual files. You will need to copy it into your guest’s Windows\System32 folder.
| Name |
|---|
| NvAgent.dll |
| nvapi64.dll |
| nvaudcap64v.dll |
| nvcpl.dll |
| nvcuda.dll |
| nvcudadebugger.dll |
| nvcuvid.dll |
| nvdebugdump.exe |
| nvEncodeAPI64.dll |
| NvFBC64.dll |
| nvidia-pcc.exe |
| nvidia-smi.exe |
| NvIFR64.dll |
| nvinfo.pb |
| nvml.dll |
| nvofapi64.dll |
| nvspcap64.dll |
| nvspinfo.exe |
NB: These files may or may not change between driver updates. These should only be taken as an example of the kind of files to look for. But typically these are the files to copy
Setup
Please note that this only works on Windows to Windows Virtual Machines. I encourage you to use QEMU/KVM with a Linux Host.
Pre-Setup
You are going to need to acquire which ever version of Windows you would like to use. For my personal use case I am using a Windows 10 IoT Enterprise LTSC build as the host machine with Hyper-V enabled. In this example, I am actually using Windows 11 Enterprise LTSC, because - while I’ve seen this mentioned on a Reddit thread somewhere, I cannot recall, apologies - it appears that the IoT builds of Windows lack some kind of Display Stack Support, and as a result cannot properly initialize the Virtual Displays.
While I am not 100% sure this was cause, I do know every time I tried to use an IoT build, either Windows 10 or Windows 11, the Parsec and Virtual-Display-Driver would eventually error out or be unusable. It was only when I moved away from IoT builds did the Virtual Display Drivers actually start working.
As part of your pre-setup, you should gather all the drivers from the System32 folder and bundle them up in a VM folder that you can copy over via the Hyper-V console.
Also please save the script under the Scripts section, as you will need to use it later on.
You should take the moment to ensure that AMD-V or Intel VT is enabled in your Bios. You will need to check your Motherboard Manual/Bios screen to find the option and ensure it is selected.
Once the ISOs are secured, files are copied, and the script saved, ensure that Hyper-V is enabled under the Turn Windows Features On or Off settings panel. You can find this panel by by searching in the windows search bar.
Once that is opened scroll down until you see the Hyper-V node and j-ust check it off. Save the changes, and Windows will ask you to restart to enable.
Once you are back into Windows, the Hyper-V Manager will be available in your Program Files, which you can find it by searching.
You are now ready to begin the Setup.
Setup
When you open Hyper-V you should be greeted with 3 sections. The left section will typically have your Computer Name, the Middle section will have a list of the Virtual Machines you’ve built, and the right section will have Actions you can take on those.
Create a new Virtual Machine by right clicking your computer’s name in the left hand panel and click on quick create. Once the panel pops up, click on ‘Select Installation Source’ and navigate to the ISO file of your choosing. Click next and once the option comes up to connect or edit settings, click on Edit Settings.
In this panel, you will need to do several things.
- Set you RAM Size to be the amount you wish to allocate to the VM.
- Under this section you will also need to turn off Dynamic RAM.
- OPTIONAL: If you are installing a Windows 11 ISO, be sure to enable
Enable Trusted Platform Moduleunder theSecurity Section. - OPTIONAL: I sometimes have issues when Booting from ISOs. Select either your ISO (under the DVD Drive) or the Hard Drive both of which are under the
SCSI Controller, and swap their locations. The ISO should be in Location 0, while the HDD should be in Location 1. This ensures the VM boots from the ISO first without any intervention. - Under the
Managementsection- You will need to turn disable Checkpoints entirely.
- Under Integration Services, disable
Guest Services. - Under Automatic Start Action, I have it set to
None. - Under Automatic Stop Action, I have it set to
Power Off.
Once this is set, Apply changes and boot the VM like you would normally. The VM will bring itself up, it will provide a Hyper-V Display for the Hyper-V Manager console. Continue with the Installation as you would normally, setting all the values you wish to use for your new OS.
Once you boot up into the OS, and you are at the desktop, its time to copy the VM folder onto the desktop. Let all the files transfer over.
Then put all the files from the host Windows\System32\DriverStore\FileRepository into the guest Windows\System32\HostDriverStore\FileRepository.
NB: On the Guest, you will need to create the folder HostDriverStore
After you copy those files, be sure to copy the files from the host Windows\System32 into guest Windows\System32.
These files are coming from the VM folder you prepared and copied into your guest desktop.
Now you want to shut down the VM.
Once the VM is completed turned off, open the script that you saved from the Scripts Section above. And Edit the $vm variable to be the name of your Virtual Machine that you created.
Open the script in the Windows PowerShell ISE as Administrator, and run it. It shouldn’t provide any output.
Launch your VM, once you hit the desktop, open up the Device Manager and you should see the name of your Graphics card without any warning or error icons. This means that the GPU is now fully recognizable inside the virtual machine and you successfully partitioned it.
You can launch MSI Kombuster to validate the GPU is actually being used to render the screen and passed through to ensure that 3D rendering can take place with some reasonable amount of performance.
Now at this point you can freely use the GPU although the current session you have isn’t going to be GPU accelerated, but the VM will still use the GPU when it can.
Setting up Parsec
At this point we will need to setup some kind of remote viewing into the VM. This way the Hyper-V console won’t need to have the VM open in a window, and the VM can safely run the background.
There are a few caveats, but we will get to those later on.
Firstly, we are going to install Parsec and install all of the drivers it suggests. Once completed login to you Parsec account and mark it as a Host computer. Effectively allowing access to the computer.
Open up your Device Manager and ensure that the Parsec Display Driver is there and doesn’t have any issues.
Once this step is completed, install ParsecVDisplay application from the Software section. Install it and then restart your computer. Once the Computer restarts you will be greeted by the ParsecVDisplay window. Click on Add Display, and with a moment, the application will appear to freeze, but it will be processing in the background.
Once the Display comes up on the ParsecVDisplay window, you will want to open your desktop’s Display Settings and set the display the app just added as your main display.
Here is the point where you go on your host machine, and login to Parsec there and ensure you can connect to the VM.
Once you have confirmed this, you’re going to have to disable the two hyper-v display adapters in the device manager section on the Virtual Machine.
Once you do that the VM will only use your GPU and the Parsec to stream it.
You might have noticed that there isn’t any audio. Just install VB-Audio and restart.
Once it comes back up you’ll have everything you need to get started.
Every time you start your VM from cold boot, there will be a sequence of items you’ll need to do to get everything back up. Please see the Notes/Limitations section for that.
Post-Setup
You’ll have to update your driver files everytime you update the Host Driver files.
I recommend making a copy of your virtual disk so you can always reference it back, or make duplicate copies for other VMs instead of fighting to redo the setup.
Notes/Limitations
As it turns out you don’t need the host and the guest to be the same windows version.
This particular setup isn’t the best, and unfortunately requires some manual setup after every restart.
- Start the VM and wait for the VM to be available in the Parsec app.
- Once it is available in the Parsec app, connect to it, and after a little while ~5 minutes, usually less. You will either get the login screen or it will drop you on the desktop. You will be in a 1024x768 screen.
- At this point ParsecVDisplay should pop up, click on Add Display, and it should add the display with the size you previously specified.
- At this point Parsec should just immediately catch the Virtual Display and it will begin transferring over.
Also please note, sometimes Parsec might fail on the first try when you trying to connect. Just try it again.
I am unfortunately using Parsec, which is closed source and communicates with Parsec servers. While I believe the VMs sitting on my machine isn’t actually bleeding any information out to Parsec, this isn’t something I am fully comfortable with. Despite my attempts to make the image crisper by upping the Resolution and allowing 50Mbps bandwidth, it still looks like a video feed.
There is also Sunshine and Moonlight, but again the fact that we need to constantly set a Virtual Display up every time we login is a concern.
Errata
If you notice any issues with this Tutorial, or any mistakes I made, no matter how minor or major. Please feel free to contact me via email at errata (at) vishalramkissoon.com. Please include the link or the name of the Tutorial