I'm looking for some help please. I need a batch script that identifies all instance id's using an output from pnputil and then removes the corresponding devices according to their instance id. I am using windows 10 and windows 11.
1. Run's pnputil /enum-devices /class "smartcardreader"
Code: Select all
Microsoft PnP Utility
Instance ID: [color=#BF0000] USB\VID_09D8&PID_0428\8&25de01d1&0&2[/color]
Device Description: Microsoft Usbccid Smartcard Reader (WUDF)
Class Name: SmartCardReader
Class GUID: {50dd5230-ba8a-11d1-bf5d-0000f805f530}
Manufacturer Name: Microsoft
Status: Disconnected
Driver Name: wudfusbcciddriver.inf
Instance ID: [color=#BF0000]USB\VID_09D8&PID_0428\6&1801434e&0&2[/color]
Device Description: Microsoft Usbccid Smartcard Reader (WUDF)
Class Name: SmartCardReader
Class GUID: {50dd5230-ba8a-11d1-bf5d-0000f805f530}
Manufacturer Name: Microsoft
Status: Started
Driver Name: wudfusbcciddriver.inf
Instance ID: [color=#BF0000]USB\VID_09D8&PID_0428\8&1324512c&0&2[/color]
Device Description: Microsoft Usbccid Smartcard Reader (WUDF)
Class Name: SmartCardReader
Class GUID: {50dd5230-ba8a-11d1-bf5d-0000f805f530}
Manufacturer Name: Microsoft
Status: Disconnected
Driver Name: wudfusbcciddriver.inf
Instance ID: [color=#BF0000]USB\VID_076B&PID_3031\7&3adb5428&0&1[/color]
Device Description: OMNIKEY 3x21
Class Name: SmartCardReader
Class GUID: {50dd5230-ba8a-11d1-bf5d-0000f805f530}
Manufacturer Name: HID Global
Status: Started
Driver Name: oem5.---
Instance ID: [color=#BF0000]USB\VID_076B&PID_3031\7&3adb5428&0&2[/color]
Device Description: Microsoft Usbccid Smartcard Reader (WUDF)
Class Name: SmartCardReader
Class GUID: {50dd5230-ba8a-11d1-bf5d-0000f805f530}
Manufacturer Name: Microsoft
Status: Disconnected
Driver Name: wudfusbcciddriver.inf
Instance ID: [color=#BF0000]USB\VID_076B&PID_5121\OKCM0021802141932272863198160893[/color]
Device Description: OMNIKEY 5x21
Class Name: SmartCardReader
Class GUID: {50dd5230-ba8a-11d1-bf5d-0000f805f530}
Manufacturer Name: HID Global
Status: Disconnected
Driver Name: oem11.---
Instance ID: [color=#BF0000]USB\VID_076B&PID_3021\7&3adb5428&0&1[/color]
Device Description: OMNIKEY 3x21
Class Name: SmartCardReader
Class GUID: {50dd5230-ba8a-11d1-bf5d-0000f805f530}
Manufacturer Name: HID Global
Status: Disconnected
Driver Name: oem3.---
3. Run's pnputil /remove-device "instance id" for each instance id remembered or outputted in the txt file above. When using the /remove-device command the instance ids should have a " before and after
e.g /pnputil /remove-device "USB\VID_076B&PID_5121\OKCM0021802141932272863198160893"
Any help would be appreciated.