pnputil uninstall integrated gpu


shoober420

Well-known member
Member
VIP
Local time
4:10 PM
Posts
231
OS
Windows 11 27965
is there a way to uninstall the integrated gpu from the system ("Device Manager > Display Adapters > Right Click "*Integrated GPU* > Uninstall device") using pnputil or another method via cli?

"/disable-device" asks for the specific hardware ID, which i dont want. i want this to uninstall any integrated GPU found no matter what system its run on. plus this method only disables the device, not uninstalls it. so the integrated gpu is still found in the system when querying with wmic.

reason being, for the HighPerfAdapter script so it chooses the correct dedicated GPU instead of the onboard integrated GPU.

 

My Computer My Computer

At a glance

Windows 11 27965Intel i7 7700 @4.0ghz64gb DDR4Radeon RX 5500 XT
OS
Windows 11 27965
Computer type
PC/Desktop
CPU
Intel i7 7700 @4.0ghz
Memory
64gb DDR4
Graphics Card(s)
Radeon RX 5500 XT
Sound Card
Topping D50s
Hard Drives
NVMe
PSU
Corsair
Keyboard
Stelseries G6v2
Mouse
Zowie EC2
Other Info
https://www.youtube.com/shoober420
You can uninstall the driver but Windows 11 will reinstall it maybe disable the GPU from Device Manager or from BIOS setup utility.
 

My Computer My Computer

At a glance

Windows 11AMD Ryzen 7 5700GMicron Technology DDR4-3200 16GBNVIDIA GeForce RTX 3060
OS
Windows 11
Computer type
PC/Desktop
Manufacturer/Model
HP Pavilion
CPU
AMD Ryzen 7 5700G
Motherboard
Erica6
Memory
Micron Technology DDR4-3200 16GB
Graphics Card(s)
NVIDIA GeForce RTX 3060
Sound Card
Realtek ALC671
Monitor(s) Displays
Samsung SyncMaster U28E590
Screen Resolution
3840 x 2160
Hard Drives
SAMSUNG MZVLQ1T0HALB-000H1
You can uninstall the driver but Windows 11 will reinstall it maybe disable the GPU from Device Manager or from BIOS setup utility.
my bios is dell, and this machines bios is not very tweakable. theres no option to disable onboard integrated gpu in bios.

i can manually disable and uninstall the integrated gpu in device manager, but i want a method to do this via CLI for convienence, and to be deployed on any machine to disable any onboard integrated GPU
 

My Computer My Computer

At a glance

Windows 11 27965Intel i7 7700 @4.0ghz64gb DDR4Radeon RX 5500 XT
OS
Windows 11 27965
Computer type
PC/Desktop
CPU
Intel i7 7700 @4.0ghz
Memory
64gb DDR4
Graphics Card(s)
Radeon RX 5500 XT
Sound Card
Topping D50s
Hard Drives
NVMe
PSU
Corsair
Keyboard
Stelseries G6v2
Mouse
Zowie EC2
Other Info
https://www.youtube.com/shoober420
You can use Dism command to uninstall third-party drivers i will post a how to Dism video.

In this video, i will show you how to uninstall offline windows operating system drivers with Dism command.,

 

My Computer My Computer

At a glance

Windows 11AMD Ryzen 7 5700GMicron Technology DDR4-3200 16GBNVIDIA GeForce RTX 3060
OS
Windows 11
Computer type
PC/Desktop
Manufacturer/Model
HP Pavilion
CPU
AMD Ryzen 7 5700G
Motherboard
Erica6
Memory
Micron Technology DDR4-3200 16GB
Graphics Card(s)
NVIDIA GeForce RTX 3060
Sound Card
Realtek ALC671
Monitor(s) Displays
Samsung SyncMaster U28E590
Screen Resolution
3840 x 2160
Hard Drives
SAMSUNG MZVLQ1T0HALB-000H1
i found that "pnputil /remove-device <Instance Id>" will remove the device from Device Manager and thus does what i want. but using "VEN_8*" doesnt appear to remove the device. i have to fully specify the Instance Id for it to work. i want this to remove any Intel integrated GPU, not just mine.

I will try to uninstall the Intel video driver (oem51.inf) and see if that removes the Intel integrated GPU from device manager
 

My Computer My Computer

At a glance

Windows 11 27965Intel i7 7700 @4.0ghz64gb DDR4Radeon RX 5500 XT
OS
Windows 11 27965
Computer type
PC/Desktop
CPU
Intel i7 7700 @4.0ghz
Memory
64gb DDR4
Graphics Card(s)
Radeon RX 5500 XT
Sound Card
Topping D50s
Hard Drives
NVMe
PSU
Corsair
Keyboard
Stelseries G6v2
Mouse
Zowie EC2
Other Info
https://www.youtube.com/shoober420
Like is said Windows 11 will reinstall the integrated GPU driver as you are not deleting the driver.
 

My Computer My Computer

At a glance

Windows 11AMD Ryzen 7 5700GMicron Technology DDR4-3200 16GBNVIDIA GeForce RTX 3060
OS
Windows 11
Computer type
PC/Desktop
Manufacturer/Model
HP Pavilion
CPU
AMD Ryzen 7 5700G
Motherboard
Erica6
Memory
Micron Technology DDR4-3200 16GB
Graphics Card(s)
NVIDIA GeForce RTX 3060
Sound Card
Realtek ALC671
Monitor(s) Displays
Samsung SyncMaster U28E590
Screen Resolution
3840 x 2160
Hard Drives
SAMSUNG MZVLQ1T0HALB-000H1
i did some research and came up with a solution.


This will uninstall any integrated Intel GPU.

This is to be used with the DisableHDR and EnableHDR scripts.



If anyone can share what the device ID for AMD integrated GPUs is, i will add it to the DisableIntegratedGPU script so that all integrated GPUs are disabled and removed
 

My Computer My Computer

At a glance

Windows 11 27965Intel i7 7700 @4.0ghz64gb DDR4Radeon RX 5500 XT
OS
Windows 11 27965
Computer type
PC/Desktop
CPU
Intel i7 7700 @4.0ghz
Memory
64gb DDR4
Graphics Card(s)
Radeon RX 5500 XT
Sound Card
Topping D50s
Hard Drives
NVMe
PSU
Corsair
Keyboard
Stelseries G6v2
Mouse
Zowie EC2
Other Info
https://www.youtube.com/shoober420
i found that "pnputil /remove-device <Instance Id>" will remove the device from Device Manager and thus does what i want. but using "VEN_8*" doesnt appear to remove the device. i have to fully specify the Instance Id for it to work. i want this to remove any Intel integrated GPU, not just mine.

I will try to uninstall the Intel video driver (oem51.inf) and see if that removes the Intel integrated GPU from device manager
You can't use wildcards, because well that would be dangerous...

The correct solution would be to disable the installed device, instead of removing the driver. Since WU tries to reinstall the "missing" driver for you.

We can assume the integrated graphics is always listed first (based on HW priority). If there's at least two graphic devices, then we can disable the first device. This script doesn't actually disable anything, because there's a -WhatIf on Disable-PnpDevice.
Code:
$Adapters = @(Get-CimInstance Win32_VideoController)

if ($Adapters.Count -ge 2) {
    $FirstAdapter = $Adapters[0]
    Write-Host "Disabling $($FirstAdapter.Name)"
    Disable-PnpDevice -InstanceId $FirstAdapter.PNPDeviceID -WhatIf
}

Your wmic query should look for the 2nd device (since we didn't remove the integrated device):
Code:
wmic path win32_videocontroller where DeviceID="VideoController2" get PNPDeviceID
 

My Computer My Computer

At a glance

Windows 7
OS
Windows 7
unfortunately disabling the device doesnt remove it, and the Hardware Id for the integrated GPU will still be present and selected.

using the DisableIntegratedGPU script above does remove the device completely so the correct dedicated GPU is selected when running the HDR scripts
 

My Computer My Computer

At a glance

Windows 11 27965Intel i7 7700 @4.0ghz64gb DDR4Radeon RX 5500 XT
OS
Windows 11 27965
Computer type
PC/Desktop
CPU
Intel i7 7700 @4.0ghz
Memory
64gb DDR4
Graphics Card(s)
Radeon RX 5500 XT
Sound Card
Topping D50s
Hard Drives
NVMe
PSU
Corsair
Keyboard
Stelseries G6v2
Mouse
Zowie EC2
Other Info
https://www.youtube.com/shoober420
1. If you remove the device, unless you block WU or someone's Intel/AMD/whatever driver update tool, then the device is likely to return. Therefore it's always better to keep the device installed, so it can be disabled.

2. You need to change your GPU selection logic. This wmic naively assumes there's always one GPU returned:
Code:
wmic path win32_videocontroller get PNPDeviceID

Whereas you could do "get PNPDeviceID" and count how many ID's are returned, and then pick the 2nd one. And your script forgets the scenario someone actually owns two add-on graphics cards.
Code:
wmic path win32_videocontroller where DeviceID="VideoController2" get PNPDeviceID

3. Removing someone's driver is a destructive act. Your scripts should allow the user to easily undo changes, and not force them to reinstall their driver. Re-enabling the idle device is non-destructive.
 

My Computer My Computer

At a glance

Windows 7
OS
Windows 7
youre right, it only removed the integrated gpu until reboot. is there a way for wmic to find the dedicated gpu by name, or it forcing to not select Intel?
 

My Computer My Computer

At a glance

Windows 11 27965Intel i7 7700 @4.0ghz64gb DDR4Radeon RX 5500 XT
OS
Windows 11 27965
Computer type
PC/Desktop
CPU
Intel i7 7700 @4.0ghz
Memory
64gb DDR4
Graphics Card(s)
Radeon RX 5500 XT
Sound Card
Topping D50s
Hard Drives
NVMe
PSU
Corsair
Keyboard
Stelseries G6v2
Mouse
Zowie EC2
Other Info
https://www.youtube.com/shoober420
You're missing the point. Integrated graphics are always listed FIRST, because it's based on the motherboard's bus order. So the SECOND adapter is always the one you care about, regardless of manufacturer. Intel/NVIDIA or Intel/AMD.

Do a sanity check that the user doesn't have only one GPU, and pick the second result that Win32_VideoController returns. Technically, someone can own two PCI graphics cards and may run your script by accident.

But the alternative is building up a list of every iGPU model shipped and matching against it. At this stage, that's probably not what you want to be spending time worrying about.
 

My Computer My Computer

At a glance

Windows 7
OS
Windows 7
on my machine the intel integrated gpu is listed second. i think it has to do with this dell bios setting.

1000007941.webp

no matter what gpu i choose, they stay in the same order. poopy dell bios, its not very tweakable.

this is my wmic output no matter what bios option i choose:
Code:
wmic path win32_videocontroller get PNPDeviceID
PNPDeviceID
PCI\VEN_1002&DEV_7340&SUBSYS_55011682&REV_C5\6&237E46A6&0&00000008
PCI\VEN_8086&DEV_5912&SUBSYS_06B71028&REV_04\3&11583659&0&10

the VEN_1002 is my radeon gpu, and VEN_8086 is the intel gpu.
 
Last edited:

My Computer My Computer

At a glance

Windows 11 27965Intel i7 7700 @4.0ghz64gb DDR4Radeon RX 5500 XT
OS
Windows 11 27965
Computer type
PC/Desktop
CPU
Intel i7 7700 @4.0ghz
Memory
64gb DDR4
Graphics Card(s)
Radeon RX 5500 XT
Sound Card
Topping D50s
Hard Drives
NVMe
PSU
Corsair
Keyboard
Stelseries G6v2
Mouse
Zowie EC2
Other Info
https://www.youtube.com/shoober420
Code:
@echo off
setlocal enabledelayedexpansion

for /f %%n in ('wmic path win32_videocontroller where "not AdapterDACType like 'Internal'" get PNPDeviceID ^| find /c "PCI"') do (
    set /a COUNT=%%n
)

REM exit if we can't find another GPU with non-Internal memory

if %COUNT% lss 1 (
    exit /b
)

for /f "tokens=1 delims= " %%d in ('wmic path win32_videocontroller where "not AdapterDACType like 'Internal'" get PNPDeviceID ^| find "PCI"') do (
    set "DEVICE=%%d"
)

REM %DEVICE% has reserved characters "&", so we need to use delayed expansion

echo !DEVICE!
 

My Computer My Computer

At a glance

Windows 7
OS
Windows 7
nice, im now able to get a very safe script that enables HighPerfAdapter setting while not touching the Integrated GPU at all with that new wmic string

Code:
for /f "tokens=1-6 delims=_&" %%a in ('wmic path win32_videocontroller where "not AdapterDACType like 'Internal'" get PNPDeviceID ^| find "PCI"') do (
    reg add "HKCU\Software\Microsoft\DirectX\UserGpuPreferences" /v "DirectXUserGlobalSettings" /t REG_SZ /d "HighPerfAdapter=%%b&%%d&%%f;AutoHDREnable=0;VRROptimizeEnable=0;SwapEffectUpgradeEnable=0"
)

im now trying to make a script that detects any Integrated GPU and disables it. this is what i got so far

Code:
foreach ($dev in (Get-PnpDevice -Class Display | Where-Object {$_.Name -like "*Intel*"})) {
    &"pnputil" /disable-device $dev.InstanceId;
}

this disables any Intel GPU, but wont disable AMD integrated ones. @garlin do you know a Where-Object string that detects only Integrated GPUs?

i tried {$_.GPU -like "*Integrated*"} but this didnt work
 

My Computer My Computer

At a glance

Windows 11 27965Intel i7 7700 @4.0ghz64gb DDR4Radeon RX 5500 XT
OS
Windows 11 27965
Computer type
PC/Desktop
CPU
Intel i7 7700 @4.0ghz
Memory
64gb DDR4
Graphics Card(s)
Radeon RX 5500 XT
Sound Card
Topping D50s
Hard Drives
NVMe
PSU
Corsair
Keyboard
Stelseries G6v2
Mouse
Zowie EC2
Other Info
https://www.youtube.com/shoober420
i came up with a solution

Code:
foreach ($dev in (Get-CimInstance win32_VideoController | Where-Object {$_.AdapterDACType -like "Internal"})) {
    &"pnputil" /disable-device $dev.PNPDeviceID;
}

@garlin hows it look?
 

My Computer My Computer

At a glance

Windows 11 27965Intel i7 7700 @4.0ghz64gb DDR4Radeon RX 5500 XT
OS
Windows 11 27965
Computer type
PC/Desktop
CPU
Intel i7 7700 @4.0ghz
Memory
64gb DDR4
Graphics Card(s)
Radeon RX 5500 XT
Sound Card
Topping D50s
Hard Drives
NVMe
PSU
Corsair
Keyboard
Stelseries G6v2
Mouse
Zowie EC2
Other Info
https://www.youtube.com/shoober420
pnputil /disable-device is smart enough to ignore any device that's actively used by the kernel, but still... code defensively.
Code:
$Adapters = @(Get-CimInstance win32_VideoController | Where-Object {$_.AdapterDACType -notlike "Internal"})

if ($Adapters.Count -ge 1) {
    foreach ($dev in (Get-CimInstance win32_VideoController | Where-Object {$_.AdapterDACType -like "Internal"})) {
        &"pnputil" /disable-device $dev.PNPDeviceID
    }
}
 

My Computer My Computer

At a glance

Windows 7
OS
Windows 7
awesome, its finalized. thank you so much for the info and help
 

My Computer My Computer

At a glance

Windows 11 27965Intel i7 7700 @4.0ghz64gb DDR4Radeon RX 5500 XT
OS
Windows 11 27965
Computer type
PC/Desktop
CPU
Intel i7 7700 @4.0ghz
Memory
64gb DDR4
Graphics Card(s)
Radeon RX 5500 XT
Sound Card
Topping D50s
Hard Drives
NVMe
PSU
Corsair
Keyboard
Stelseries G6v2
Mouse
Zowie EC2
Other Info
https://www.youtube.com/shoober420
Back
Top Bottom