To disable the ability to install new devices on Windows 7, you can create/modify the following registry key:

 

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\DeviceInstall\Restrictions]
“DenyUnspecified”=dword:00000001

 

To re-enable the ability, simply change the dword value of DenyUnspecified to 0.

 

Note that you will likely need to create the registry key directories for DeviceInstall and Restrictions.

 

Credit