3

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.

2
  • 1
    I guess you mean Get-WindowsDriver -online | where OriginalFileName -like *\cxru0x64.inf since the property is originalfilename not originalname, and it gives the full path not just the filename. Commented Jun 20, 2024 at 2:18
  • You're right - Thanks man. That works perfect. Seems like I was too focused on how pnputil returns the value intstead of get-windowsdriver. Commented Jun 20, 2024 at 9:50

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.