You try to copy a file, format a drive, or save anything, and Windows throws STG_E_DISKISWRITEPROTECTED (that's 0x80030013 back in hex). It's maddening because the drive looks fine otherwise. Let's fix it.
The Fix (90% of cases)
- Check for a physical write-protect switch. This is the most common cause on SD cards, microSD adapters, and some USB flash drives. Look at the side or edge of the card or adapter for a tiny slider. If it's in the locked position, slide it to unlock. Try the drive again.
- No switch? Run diskpart. Open Command Prompt as Administrator (right-click Start, choose "Command Prompt (Admin)" or "Windows Terminal (Admin)"). Type:
diskpart
list disk
select disk X (replace X with your drive number — be certain, you'll wipe it)
attributes disk clear readonly
clean
create partition primary
format fs=ntfs quick (or fat32 quick for small drives / SD cards)
assign letter=Y (pick an unused letter)
exit
Why this works: The attributes disk clear readonly command removes the read-only flag that Windows stores on the disk itself. That flag can get stuck after an unsafe ejection, a power loss, or just a glitch in how the controller reported its state. The clean and format steps rebuild the partition table and filesystem from scratch, bypassing any corruption that made Windows think the disk was locked.
Important: This nukes all data on the drive. If you need the data, use a recovery tool before step 5.
Real-world trigger: I've seen this most often after pulling an SD card from a camera while it was still writing, or after a Windows update that corrupted the disk's attribute cache.
Less Common Variations
Registry-Imposed Write Protection
Some enterprise IT policies or malware set a global write-protect flag via the registry. This affects all removable drives. Check this path:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies
If the WriteProtect DWORD exists and is set to 1, change it to 0 and restart. If the key doesn't exist, you're fine — the default is off.
Driver or Controller Quirk
Some USB 3.0 controllers (especially on older Intel chipsets like the 7-series) have a weird interaction with certain flash drives. The fix is to uninstall the USB controller in Device Manager under Universal Serial Bus controllers (right-click → Uninstall device), then reboot. Windows will reinstall the driver fresh. This clears a cached state that can lock writes.
SD Card Locked by the Reader
This one trips people up: the microSD-to-SD adapter itself has a write-protect switch. If you're using a microSD in an adapter, check the adapter's side. The switch on a microSD card doesn't physically change anything — it's just mechanical contact that the reader reads. If that contact is broken (dirt, wear), even unlocking won't help. Try a different adapter.
Prevention
Three things will keep this from recurring:
- Always safely eject. Windows' "Safely Remove Hardware" isn't optional — it flushes the write cache and tells the controller to finish its internal state. Skipping it is how the readonly flag gets corrupted.
- Don't yank a card mid-write. That's the main cause on cameras and phones. Wait for the activity light to stop.
- Format in the device. If you're prepping a drive for a specific gadget (camera, dashcam, Raspberry Pi), format it using that device's own format tool. The filesystem layout is more likely to be cleanly supported.
Write protection is a safety feature, not a permanent curse. The disk is fine — it's just a flag that got set wrong. You've now got the tools to clear it.