If you use your laptop or computer in shared spaces such as cafes, libraries, or even offices, you should disable the computer's USB ports. This will keep your system safe from malware and stop your data from being stolen.

Before you choose and try one of the listed methods, make sure you’ve logged into an administrator account. Otherwise, you’ll not be able to make the required system changes.

For each of the methods, we’ll show you how you can re-enable the USB ports, so you can still use them, when necessary.

How to Disable USB Ports With Device Manager

If you’re looking for an easy solution to disable the USB ports to prevent malware infection, try doing it with Device Manager. In Windows, Device Manager is a great tool for managing drivers, so there’s a chance you’ve used it before.

  1. Open Device Manager.
  2. Expand the Universal Serial Bus Controllers list.
  3. Right-click the USB port and select Disable device.
Device Manager menu.

If you’re sure a USB doesn’t have any viruses or malware, go through the above steps and select Enable to connect it without any problems.

How to Disable USB Ports With the Registry Editor

If you’re accustomed to editing the Windows Registry, you can easily use it to disable your computer’s USB ports. Even if you’re tech-savvy, you should create a restore point in case something goes wrong.

  1. In the Start menu search bar, search for registry editor and select the Best match.
  2. In the left pane, navigate to HKEY_LOCAL_MACHINE > SYSTEM > CurrentControlSet > Services > UBSSTOR.
  3. Open Start.
  4. Set Value data to 4 and click OK.
Registry Editor in Windows 10.

If you want to re-enable USB ports, go through the above steps again and set Value data to 3.

Malware can take advantage of the Windows AutoRun feature, so malicious programs can start running as soon as you connect the USB. To protect your computer, you should disable the Autorun utility for external devices.

In Registry Editor, head to HKEY_CURRENT_USER > Software > Microsoft > Windows > CurrentVersion > Policies > Explorer. There, double-click NoDriveTypeAutoRun, set Value Data to 4, and click OK.

How to Disable USB Ports with Group Policy Editor

The Group Policy Editor is a Windows built-in tool that allows you to personalize your computer or network settings. In this case, you can use it to disable your computer's USB ports.

  1. Use the Win + R keyboard shortcut to bring up a Run dialog.
  2. Type gpedit.msc and press Enter. Windows will now open the Local Group Policy Editor.
  3. Using the left-hand menu, navigate to Computer Configuration > Administrative Templates > System > Removable Storage Access.
  4. In the right part of the window, locate and open Removable Disks: Deny execute access.
  5. Select Enabled and click Apply > OK.
  6. Open Removable Disks: Deny read access​​​​​​, select the Enabled option and save the new system settings.
Group Policy in Windows 10.

If you need to enable the USB ports again, go through the above steps and select Not Configured for both settings.

How to Disable USB Ports With the Command Prompt

Using Command Prompt is a fast way to disable or enable the USB ports, especially if you save the command lines in Sticky Notes or other alternatives for quick access.

To disable the USB ports, open Command Prompt with administrative rights. Then, type reg add HKLM\System\CurrentControlSet\Services\cdrom /t REG_DWORD /v "Start" /d 4 /f and press Enter.

If you want to re-enable the USB ports, enter the reg add HKLM\System\CurrentControlSet\Services\cdrom /t REG_DWORD /v "Start" /d 1 /f command line and press Enter to run it.

Command Prompt in Windows 10.

Avoid Malware Infection on Windows

These tips will help you disable the USB ports and keep your computer safe from malware. If you’re more concerned about your data being stolen, you can password protect your computer, folders, or files.