prevents anyone from connecting a USB without your permission

This method of protection is especially effective if you are a laptop user, and you take it from one place to another. Likewise, if you usually sign up for one of the famous LAN Parties, where you take your desktop PC and often leave it unattended, it might be a very good idea to block the ports so that no one can connect a USB without your consent, right? Well, let’s see how it’s done, because it’s quite simple.

How to prevent USB storage from being connected to your PC

For this first method we are going to use the Group Policy Editor of Windows, a tool that is only available in the Pro versions of the Microsoft operating system, both in its Windows 10 and Windows 11 versions. The first thing you should do is right-click on the start button and select Run. Then, type “gpedit.msc” without the quotes and you will access this tool.


In this tool, you have to navigate on the left side to: Computer Configuration -> Administrative Templates -> System -> Device installation -> Device installation restrictions, and on the right side you have to double click on “Prevent installation of removable devices” to edit its settings.

In the window that opens, simply check the “Enabled” option and click OK. Restart the computer and that’s it, you’ve already prevented anyone from connecting USB storage drives to your computer, although of course, this includes your own. To deactivate this, you simply have to follow these steps again and check the option “Not configured” or “Disabled” to be able to reconnect USB drives to the PC.

If you don’t have the pro version of the operating system, or if you prefer to block USB ports in a slightly more permanent way, we will explain the alternative below, which is using the Registry Editor Windows. To open it, go back to the Run window (you can also access it by pressing the WIN + R key combination) and type “regedit” without the quotes.


Here you must navigate through the menu on the left (or alternatively, type or paste in the bar above) to the following registry key:


Once here, right-click on the Windows folder on the left and select New -> Key. A new folder will automatically appear hanging from Windows called “New Key #1” and it gives you the opportunity to rename it; you must call her DeviceInstall (This key may already exist, if so, skip this step.) Then, right click on this “folder” that you have created and hit New -> Password again. The new key that you must create must be called restrictions.

Once this is done, click on Restrictions and, now in the right part of the window, right click and select New -> DWORD (32-bit) Value. The new value you created should be called DenyRemovableDevices.

block usb

Now double click on the DenyRemovableDevices key, make sure that on the right side “Base” is selected Hexadecimal, and in the Value data field change the 0 (zero) that comes by default to 1. Click OK, restart the PC , and you will have blocked the possibility of connecting storage units on your PC.

To undo this, you simply have to follow the same steps that you have followed before and either change the value of this key to 0, or directly delete the keys that you have created.

How to ALLOW some USB drives

The above two methods will block the possibility of connecting ANY USB storage device to your PC, but logically there is a possibility that you want to install some pen drive or external hard drive of yours. Don’t worry, because it can be done and, in fact, it is relatively simple. You should reopen the Local Group Policy Editor that we have seen before, and in exactly the same place you will find “Allow installation of devices matching any of these id. of device”.

Allow connect USB

Double click on this option, select “Enabled” and, by doing so, the “Show” button will be enabled at the bottom left (under options). Click on it and another window will open in which you can select the units you want to allow (logically, these must be connected to the PC at the time of carrying out this configuration).

Related Articles