I want my application sometimes to block plugging in new devices except usb mass storage and usb camera and sometimes not to block anything.

I have found information how to allow installing only specific hardware. I have made simple registry file which does this (*.reg):

Windows Registry Editor Version 5.00


"**DelVals."=" "

Unfortunately this is not exactly what I am looking for.

I can dynamically change DenyUnspecified but once new hardware is installed and DenyUnspecified is changed to 00000001 I can replug this hardware and use it without restrictions.

Is there other policy which will be preventing connecting new hardware instead of just installing?

  • Is there a specific reason you are trying to disable USB devices within the registry? You can disable USB devices with GPO which is much more easy and managable. Take a look at this link: prajwaldesai.com/how-to-disable-usb-devices-using-group-policy – Smeerpijp Dec 1 '15 at 12:28
  • 1
    These registry values can be generated by GPO. There is no difference if you write them manually. The problem is there is no policy in GPO that will do what I need. – Filip Hazubski Dec 1 '15 at 13:45
  • @doenoe I forgot to mention the most important reason why I use *.reg files.. Not every version of Windows has gpedit.msc. However registry values created by that program works in every version of Windows. – Filip Hazubski Dec 4 '15 at 6:45

Hmm, I see your issue. I'm not sure only reg changes can prevent your issue. Perhaps a (monitoring) 3rd party application will work?

  • 2
    Currently I am working with devcon.exe. I think it will do. I don't see any better way. – Filip Hazubski Dec 1 '15 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.