How to get driver version by Hardware ID?

I’m trying to get the all drivers version show in device manager by Hardware ID. And first I tried is to use Powershell to show the version list.

gwmi Win32_SystemDriver | select name,@{n="version";e={(gi $_.pathname).VersionInfo.FileVersion}}

but it seems not all the drivers in the computer and I still cannot know the HWID.
Then I tried the wmi win32_pnpsigneddriver. But it return only pnp driver.
I think the closest way is to use setupapi.h

SetupDiGetDeviceInterfaceDetail()

but after trying it always returns an error “No more data is available.”.

could anyone gives me any example or correct way to find it?
Thanks a lot!


Source: c++

Leave a Reply