Block USB Storage Devices (Flash Drives) via Registry

Stop Windows from mounting USB flash drives and external disks by disabling the USBSTOR service.

WindowsregistryusbsecurityMedium risk
Run `reg add "HKLM\SYSTEM\CurrentControlSet\Services\USBSTOR" /v Start /t REG_DWORD /d 4 /f` as administrator and restart the PC.

01Command

Command
$ reg add "HKLM\SYSTEM\CurrentControlSet\Services\USBSTOR" /v Start /t REG_DWORD /d 4 /f

02What it does

Setting the USBSTOR service Start value to 4 (Disabled) makes Windows ignore mass-storage devices — plugging in a flash drive or external hard disk simply does nothing, while keyboards, mice, and other USB gear keep working. This is a common lockdown for shared or front-desk PCs where people shouldn't copy files to or from a stick. Setting the value back to 3 (Manual/On demand) restores normal behavior.

03Risk

RiskMedium risk
Requirements需要管理员权限;重启后生效;只影响 USB 存储设备,不影响鼠标键盘。
!Warning: Already-plugged devices can still appear until you restart, and a determined user with admin rights can undo this. On modern Windows you may also enforce this centrally with the Storage CSP (RemovableDiskDenyRead/Write) if you manage devices.

04Undo

Undo
$ reg add "HKLM\SYSTEM\CurrentControlSet\Services\USBSTOR" /v Start /t REG_DWORD /d 3 /f

05Sources

Last verified: 2026-09-18 · Category: Security & Privacy

06Related solutions