Linux Host, Windows Guest, GPU passthrough reinitialization fix

now this is a bit old … but it just popped up for me on google search and I wanted to give the OP some love for the original post and to suggest an easier approach.

For those who can’t be bothered to download the driver development kit … you can get the same effect as devcon using the pnputil command (built into ALL versions of win10 … and earlier … I think … definitely used it on Win 7 and Win 10 at any rate). This does all you need. First you need to get the id of the device you want to shut down and start up … e.g. for my graphics card I’m passing through to win 10 (I don’t pass through the audio card).

C:\WINDOWS\system32>pnputil /enum-devices /class Display
Microsoft PnP Utility

Instance ID: PCI\VEN_1002&DEV_66AF&SUBSYS_081E1002&REV_C1\4&23f93f77&0&00E0
Device Description: AMD Radeon VII
Class Name: Display
Class GUID: {4d36e968-e325-11ce-bfc1-08002be10318}
Manufacturer Name: Advanced Micro Devices, Inc.
Status: Started
Driver Name: oem1.inf

You can then pass the instance ID to pnputil /enable-device or pnputil /disable-device.

Thus my startup script is:

pnputil /enum-devices /class Display
pnputil /enable-device "PCI\VEN_1002&DEV_66AF&SUBSYS_081E1002&REV_C1\4&23f93f77&0&00E0

And my shutdown script is:

pnputil /enum-devices /class Display
pnputil /disable-device "PCI\VEN_1002&DEV_66AF&SUBSYS_081E1002&REV_C1\4&23f93f77&0&00E0

I keep the enum-devices command in the script in case somethng changes and they need updating … so I can rememebr how. I have Win Pro so use the GPEdit.msc startup/shudown scripts but you can probably find something in the task scheduler if you don’t.

New here … so if people think I should post this as a new thread instead of pinging a super old one … let me know and I will.

The pnputil command is a must have for all Win10 users as it lets you delete the old and unused drivers cluttering up your drive. After you un-install a driver … Win10 loves to auto install these old uninstalled drivers onto your devices when your trying to update to a newer version. It’s always good to purge those previous versions (pnptuile -e to find them and pnputil -d to delete them).

It’s better than rolling back your VM. Though … frankly … I’ve no idea how your supposed to be able to cope with windows 10 if you can’t do that.

Switch on … BSOD or crash from failed auto-update … roll back Windows 10 to a week ago … Peace on earth.

Now back to ma Jonesin!