Running the devcon.exe properly (enabling/disabling the device from command line in Windows 10)

14,802

I thought your issue could be related to an incompatibility with Windows 10 Enterprise, as I've had some issues at work with it. However, it's most likely due to using the wrong version of devcon.exe I would confirm you're using devcon.exe from the x64 folder.

Share:
14,802

Related videos on Youtube

Dev Pandu
Author by

Dev Pandu

NULL

Updated on September 18, 2022

Comments

  • Dev Pandu
    Dev Pandu over 1 year

    I have a device in my PC which runs on Windows 10, Enterprise version:

    I would like to disable and re-enable this particular device (and possible all others of the same prefix) every time Windows restart, preferably completely without my (or anyone else's) interaction.

    In order to achieve this, I am trying to write a simple batch script of 2 lines and putting script's shortcut to folder opened with pressing WIN+R and typing shell:startup. The content of the script is:

    devcon.exe disable "PCI\VEN_1002&DEV_687F*"
    devcon.exe enable "PCI\VEN_1002&DEV_687F*"
    

    However, running this (from command line, in folder where devcon.exe is located) as a regular user which is actually "an Administrator" doesn't produce any errors in the command prompt, but it also doesn't disable the card - it doesn't look like disabled in Device Manager and the card is still visible and usable in some other programs/tools.
    After "re-enabling" (which obviously re-enables nothing) the card simply doesn't show the same performance like it does when I do all this manually, by mouse-clicking in Device Manager.

    I tried various combinations of running this as "an Administrator" because by many other suggestions I am suppose to run "it" like this (just to mention that I am very new in the Windows environment). I tried to run cmd as an admin, devcon as an admin, run both things in the same time as an admin, tried to run my script as a task in Task Scheduler with "Run with highest privileges" checked, using runas and finally, enabling the built-in Administrator account, rebooting the machine, logging in as an Administrator user and trying to run both commands individually, each time welcomed by the following error:

    C:\Users\mm\Downloads>devcon.exe disable "PCI\VEN_1002&DEV_687F*"
    PCI\VEN_1002&DEV_687F&SUBSYS_0B361002&REV_C3\6&3B544653&0&00000008: Disable failed
    No matching devices found.
    

    The screenshot provided should prove that device is there and that path which I'm trying to use in devcon.exe is correct.

    Am I using devcon.exe incorrectly? If not, can someone explain me what could be the reason of my error and how to possibly get rid of it?

    • Admin
      Admin over 6 years
      Have you tried to copy and paste the entire instance ID instead of using a *?
    • Admin
      Admin over 6 years
      Possible duplicate of superuser.com/questions/616111/…
    • Admin
      Admin over 6 years
      I did, yes, and then instead of full device path in my error, I get only No matching devices found line.
  • Dev Pandu
    Dev Pandu over 6 years
    Wow! Just wow! :) Thanks a lot for this suggestion, it seems that that was the actual problem - wrong devcon.exe version :/ (Note to self - next time you work after midnight, just stop and go to sleep)