The Windows Registry, Is a very powerful tool to perform an array of edits and tweaks dedicated to the device on which It's applied. One of these tweaks that I'll cover In this tutorial, Is to enable write protection on all USB ports. Essentially, the contents of any USB device that's plugged Into the computer, will be "read only", meaning all stored data cannot be edited or deleted. Any attempt to do so, will be denied by the operating system.
I've already documented a guide on how to do this by using the good old Group Policy Editor. However the GPE Is only native to the Windows 10 Pro, Enterprise and Education editions and not every user has either of these editions Installed, hence my decision to apply this tweak via the Registry.
This comes to very good use (as an example) for anyone who has physical access to your PC, plugs In your USB stick that you've left lying around and attempts to edit or delete files. In doing so, an error message will be returned denying such operations. So let's rip Into this guide.
To access the Windows Registry, open the Run menu, type "regedit" (no quotes) and hit "OK".
Next, navigate to the following directory:
Right-click the "Control" folder and select "New > Key" as Illustrated below.
Name the key (that you've just created In the above step), as "StorageDevicePolicies", again without the quotes.
Right-click "StorageDevicePolicies", and select "New > DWORD (32-bit) Value".
Name the Value (that you've just created above), as "WriteProtect" without quotes. The result will look like the Image below.
Double-click "WriteProtect" and In the Value data field, give It a value of 1. Click "OK" to finalize the process.
A reboot Is not required, nor the need to log off & log on. Now to put this to the test. I've attempted to add and edit a file on my USB stick, and as you can see, the message of "The disk Is write-protected" Is displayed. Perfect!
As mentioned at the beginning of this article, this tweak Is only dedicated to the computer on which It's applied to. It does not write-protect the USB device Itself, but certainly prevents any changes to the device when plugged Into "any" USB port. To reverse the change, go back to Step Six above, and In the Value data field, give It a value of 0.
The Windows Registry Is a critical part of the operating system and any Incorrect edits, can cause significant system Instability and/or loss of functionality to your operating system. For this very reason, I strongly suggest backing It up prior to any edits, by using It's Export feature.