0

I'm trying to run some old software that refuses to launch (an issue for many users) unless the "HID-compliant consumer control device" devices, under Windows 10's "Device Manager", are disabled. I was able to do so with the simple batch script (using devcon):

devcon.exe /r disable @"PLACEHOLDER*"

however I was wondering if its possible to then run

devcon.exe /r enable @"PLACEHOLDER*"

upon exit of the application.

I attempted a little Power-Shell script to try and make my initial script more universal:

$id = (Get-CimInstance Win32_PnPEntity |

where caption -match 'HID-compliant consumer control device').pnpDeviceID

$ppid = "{0}{1}" -f '@',$id

Set-Location c:\PLACEHOLDER

Devcon status $ppid

Devcon enable $ppid

Devcon status $ppid

However this was met with a multitude of errors such as the script not being signed when attempting to test within "PowerShell ISE".

Any insight or assistance anyone can offer would be greatly appreciated.

  • As far as I was aware, `devcon` is not buit into Windows 10, are you sur that your system(s) have it? – Compo Jun 14 '21 at 15:17
  • If disabling the device does not require a reboot, you could probably do it using [tag:wmic] from your batch file. `@%SystemRoot%\System32\wbem\WMIC.exe Path Win32_PnPEntity Where "Name='HID-compliant consumer control device'" Call Disable 1>NUL 2>&1`, then `@YourApplication.exe`, and finally, to re-enable it again `@%SystemRoot%\System32\wbem\WMIC.exe Path Win32_PnPEntity Where "Name='HID-compliant consumer control device'" Call Enable 1>NUL 2>&1`. – Compo Jun 14 '21 at 15:37
  • @Compo thank you for your solution, however, be it error on my end or something else, this does not seem to yield a successful result. Attempting to run just `@%SystemRoot%\System32\wbem\WMIC.exe Path Win32_PnPEntity Where "Name='HID-compliant consumer control device'" Call Disable 1>NUL 2>&1` does not seem to disable the desired devices. Pasting all 3 inputs that you offered into a batch script, however, does result in the target application launching. This is met with an immediate crash to desktop, which is characteristic of the previously mentioned devices still being enabled. – absoluteidiot Jun 14 '21 at 16:10
  • @Compo my previous message was too long to include this, thank you for the time you've spent on this question, I do apologise if I have wasted your time on this. – absoluteidiot Jun 14 '21 at 16:12
  • Remove the redirection to the NUL device, and run the command `%SystemRoot%\System32\wbem\WMIC.exe Path Win32_PnPEntity Where "Name='HID-compliant consumer control device'" Call Disable` from a Command Prompt window, to see whatever output is returned. Then post it as a comment or addition to your question. It is also very possible/likely that you'd need to run the batch-file, _or Command Prompt test, (if you see an error from above)_, elevated, _Run as administrator_. – Compo Jun 14 '21 at 16:17
  • Incidentally, if you're using PowerShell, have you tried it without `devcon`, and using the cmdlets `Get-PnpDevice` with `Disable-PnpDevice` and when needed `Enable-PnpDevice`? Example `Get-PnpDevice -FriendlyName 'HID-compliant consumer control device' | Disable-PnpDevice`. – Compo Jun 14 '21 at 19:07
  • @Compo `%SystemRoot%\System32\wbem\WMIC.exe Path Win32_PnPEntity Where "Name='HID-compliant consumer control device'" Call Disable` works perfectly (when running with elevated permissions)! Now I just need to figure out how to run the opposite (enabling devices) after the exit of the application! Thanks so much for this it's been a massive help! – absoluteidiot Jun 15 '21 at 02:12
  • At what point did you expect to be able to disable system devices with standard user privileges? Why do you have to figure it out how to enable devices? What was wrong with the WMIC method I've already given you? or in fact the PowerShell commands? – Compo Jun 15 '21 at 09:07
  • @Compo I think I've been a bit unclear with my intentions and reasoning. Disabling the HID-compliant consumer control devices is only required when this older application is being used (issues with I/O polling) and some features, such as multimedia buttons cease to function with these devices disabled. My intention was to figure out a script that disables said devices while the application is running and enable said devices after the application has terminated. I'm not expecting to disable system devices with standard user privileges, hopefully this clears things up. – absoluteidiot Jun 16 '21 at 03:55

0 Answers0