I needed to disable smartcard reader on my client laptop because for some reason it had two smartcard readers and I only needed to use one so I had to disable that device on every laptop which I installed so I wanted to make it a bit easier for me.
First of all you need to download DevCon from Microsoft website.
For some really weird reason I wanted to disable all Nokia devices on my system I use:
devcon disable *nokia*
This will disable all device which have word nokia on their id, description or so on.
When I want to enable all Nokia devices I just say:
devcon enable *nokia*
If you know which device you want to disable/enable but you don’t know how to disable it just use
devcon hwids *
and search your device from that list. Then you need to find something which is only with that device so you won’t enable/disable wrong devices.
You can do that using find with devcon:
devcon find *nokia*
and you should see which device devcon see. If it only find one device then you can use that *nokia* string but if it finds more than one device then you need to find better string for devcon (example hwid if nothing else).
Because I’m lazy I do small script for everything =)
My enable script is on.bat:
devcon enable *%1*
and off.bat script:
devcon disable *%1*
So I can just say:
on nokia and all my Nokia devices will be enabled or
off nokia and all Nokia devices will be disabled :-)
When I want to know if something is enabled or disabled (when you example want to write script where you need that information you can do something like that (my ask.bat):
devcon status "*%1*"|find /i "running" && set x=1
if %x%==0 echo Nope it's not running
if %x%==1 echo Yep it's running