0

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

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\DeviceInstall\Restrictions]
"AllowDeviceClasses"=dword:00000001
"DenyUnspecified"=dword:00000001

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\DeviceInstall\Restrictions\AllowDeviceClasses]
"**DelVals."=" "
"1"="{4d36e970-e325-11ce-bfc1-08002be10318}"
"2"="{71a27cdd-812a-11d0-bec7-08002be2092f}"
"3"="{4d36e967-e325-11ce-bfc1-08002be10318}"
"4"="{4d36e96a-e325-11ce-bfc1-08002be10318}"
"5"="{6bdd1fc6-810f-11d0-bec7-08002be2092f}"
"6"="{36fc9e60-c465-11cf-8056-444553540000}"

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
0

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.