I have a bunch of machines where an OEM driver was installed manually without an installer such as an msi.
I am trying to write a script in powershell that finds the oem##.inf of the driver and then outputs to pnputil to delete the driver.
I tried writing some code which successfully deletes the driver by searching from the driver ProviderName however this is the wrong way of doing it (see below):
$driver = (Get-WindowsDriver -online | where ProviderName -eq "HID Global").Driver
pnputil /delete-driver $driver /uninstall /force
I want my script to look for the 'Original Name' instead and pipe that to PNPutil. The original name value is cxru0x64.inf. When querying the driver in pnputil it appears as so:
Published Name: oem3.inf Original Name: cxru0x64.inf Provider Name: HID Global Class Name: Smart card readers Class GUID: {50dd5230-ba8a-11d1-bf5d-0000f805f530} Driver Version: 05/25/2017 1.2.29.156 Signer Name: Microsoft Windows Hardware Compatibility Publisher
Tried this:
$driver = (Get-WindowsDriver -online | where OriginalName -eq "cxru0x64.inf").Driver
pnputil /delete-driver $driver /uninstall /force
Expecting the driver to uninstall where $driver = oem3.inf
I believe I may be using the syntax incorrectly.
Get-WindowsDriver -online | where OriginalFileName -like *\cxru0x64.infsince the property is originalfilename not originalname, and it gives the full path not just the filename.