

''' Specifies the behavior to get a driver when calling the function. Maybe the related PowerShell Automation code is not properly optimized.įirst of all these two enums and a class that will serve to represent the information of a driver: Imports

NET Framework 4.8 with Microsoft.PowerShell.5.ReferenceAssemblies package and it was unable to find the Get-WindowsDriver cmdlet.Īlso take into account that this was my very first time using these PowerShell automation APIs. net 5.0 (version 7.1.7 of the related PowerShell Nuget packages) is required to run this. Since I have not been able to obtain a solution using WMI or Windows API, I have turned to integrated Powershell. The simplest solution for me it would be to run and parse the Get-WindowsDriver cmdlet output, but I really would like to dig into WMI (or the exported functions from setupapi.dll) to be able mimic the same output as Get-WindowsDriver, and for doing that I need to understand how can I determine when a installed driver it's a third-party driver and when it is not. I also found this C# code example with P/Invokes to the setupapi.dll, but I'm not sure if this API provides a function to determine if a driver it's third-party. Pnputil.exe /export-driver * "full path of folder" In the same way, I found these programs that will export/backup only the third-party installed drivers:ĭism.exe /online /export-driver /destination:"full path of folder" If the -All parameter is not specified, Get-WindowsDriver it only lists the third-party installed drivers. If you do not specify this parameter, only third-party drivers and listed. I found that the PowerShell's Get-WindowsDriver cmdlet serves to list all the installed drivers (driver name, type, version, path, etc) and it has the -All parameter:ĭisplays information about default drivers. It is any driver that you download and install after you have installed Windows.įor example all these are my third-party installed drivers:

My question is: being able to identify a installed driver by for example its ClassGuid property from Win32_PnPSignedDriver class, how can I determine whether that specific driver it's a third-party driver or it is not?.īy third-party drivers I mean drivers that are not built into the Windows system image (Install.wim). I found these WMI classes from which in combination I think I could retrieve all the installed drivers and useful information including the directory path: Win32_SystemDriver, Win32_PnPSignedDriver, Win32_PnPEntity, Win32_PnPSignedDriverCIMDataFileīut I can't figure how to determine if a driver its a third-party driver or it is not.

In C# or VB.NET, I would like to retrieve a list of third-party installed drivers.
