Write Protect USB Drive Or Prevent Connection And AutoRun

USB Write Protect is a free portable utility to protect files in your USB drives from being accidentally modified or deleted. It can also prevent an unauthorized user from connecting their own USB drive to copy your files and it can disable the autorun function.

USB Write Protect Features

USB Device Write Protection – Enable to prevent files on any USB storage device from being accidentally modified or deleted (and to protect against malware infecting the drive).

USB Device Lock – Lock to prevent any USB storage device being connected to the computer. You will not be able to read from or write to any USB storage devices – they will not show up in Disk Management or (My) Computer/Explorer.

USB Device Autorun – Disable to prevent USB devices from automatically running programs (primarily a security benefit – stops malware autorun and transferring to your computer). Note: this will prevent Autorun of all devices – including DVD drives.

Tip: to help prevent infection of a USB drive by a virus on a different computer, create a folder called autorun.inf in the root of the USB drive.

Password – designed to prevent anyone changing your program settings but it can be overridden by a blank password so isn’t really of much benefit. The best way to protect the program settings is to just store the program in an obscure directory, not in Downloads etc.

Using USB Write Protect – Download the usbpw program from the developer here in a zip file – currently the second program on the page.

  • Unzip (extract) the USBWriteProtect.exe program to your computer – don’t save and run it from your flash drive or you could lock yourself out of the drive (you would then have to re-download the program and run it from your computer to unlock it)
  • Run the USBWriteProtect.exe program (if using Vista or Windows 7 you need to right click the program and select ‘Run as administrator’) – the main window opens as shown below:


  • Select from the 3 options as required – if all were chosen for maximum security, Write Protection would show ‘Enabled’, Device Lock would show ‘Locked’ and Device Autorun would show ‘Disabled’.

The program also lists USB storage devices that are currently plugged in – if there are any, they will need to be removed and re-inserted before any changes to them can take effect.

Important: like all such programs, it can only protect USB drives on the computer you run the program on – if you take the USB drive to a different computer it will no longer be protected.

To achieve write protection on all computers you would need a USB drive with a hardware switch to disable writing to the drive – these are very rare but a good alternative is to follow our memory card guide instead as memory cards do have a write protect switch.

Tech Notes (How The Program Works) – The program works by changing some standard Windows registry settings – you could make these changes yourself but it is far more complicated. However, advanced users and techs may be interested in which registry keys control these settings – they are as follows:

USB Device Write Protection – Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies. You may need to create this StorageDevicePolicies key if it is not already present.

Right click this key and create a New DWORD Value – name the entry WriteProtect. Then edit the new WriteProtect entry and change the value from 0 to 1. (1 disables writing to all USB devices, 0 enables writing to all USB devices).

USB Device Lock – Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\UsbStor and change the value of Start from 3 to 4. (4 prevents any USB storage device being connected to the computer, 3 allows any USB device to be connected).

USB Device Autorun – Navigate to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer and make a note of the default value of NoDriveTypeAutoRun – it is different in each version of Windows.

Now change its value to a hex value of 0xFF (255 decimal). 0xFF disables Autorun on all kinds of drive – change back to the default value to enable Autorun again.


USB Write Protect is a neat utility that makes it simple to configure security options for all USB storage devices on a computer.