0

I am looking for a way to delete all devices from the device manager in Windows containing a certain string in the instance ID. I should be able to do it using tools already on the computer.

I have a microphone that attaches to the computer as an Audio, USB and HID device. The instance ID always contains VID_0911, like here:

USB\VID_0911&PID_1F40&MI_00\6&42c3796&0&0000
USB\VID_0911&PID_1F40&MI_01\6&42c3796&0&0001
HID\VID_0911&PID_1F40&MI_01\9&3439e3e8&0&0000
USB\VID_0911&PID_0C1D&MI_05\8&2075f95b&0&0005
HID\VID_0911&PID_0C1D&MI_03\7&d0dd64c&0&0000

It can also be found by the device name: SpeechMike III

I'd like a script that deletes these devices, whether attached or not.

I have tried this script from Uninstall Device from powershell:

get-wmiobject -Query "select * from win32_systemdriver where caption=`"SpeechMikeIII`"" | 
ForEach  { $_.StopService()
$_.Delete()
 } 

It runs without error but the devices are still there.

2 Answers2

0

Pnputil.exe should be in your path already. Run as Administrator.

$device=Get-PnpDevice -FriendlyName "SpeechMike III"
&"pnputil" /remove-device $device.InstanceId
0

This worked for me.

get-pnpdevice -friendlyname 'bluetooth device (personal area network)' |
  disable-pnpdevice -confirm:$false
js2010
  • 23,033
  • 6
  • 64
  • 66