Block USB Instantly When PC Locks – Auto Re-Enable on Unlock (No Software)
What if your PC could automatically block USB drives the moment you lock it—and re-enable them instantly when you unlock?
In this video, I’ll show you a powerful Windows automation trick that does exactly that—no third-party software required.
Using Task Scheduler + built-in Windows tools, you’ll learn how to:
1. 🔒 Automatically block USB storage when your PC is locked
2. 🔓 Re-enable USB access the moment you unlock
3. 🛡️ Prevent unauthorized USB data access
4. ⚙️ Set it up using advanced but safe Windows automation
5. 💻 Keep keyboard & mouse working normally
This method works on Windows 10 and Windows 11, is lightweight, and is ideal for:
1. Shared or office PCs
2. Security-conscious users
3. IT admins & power users
4. Anyone who wants better physical data protection
🚀 What You’ll Learn
✔️ How USB access actually works in Windows
✔️ How to trigger actions on PC lock & unlock events
✔️ How to safely enable/disable USB storage automatically
✔️ Why this method is more secure than manual USB blocking
⚠️ Important Notes
1. This blocks USB storage devices only
2. Keyboard, mouse & USB charging still work
3. Requires administrator privileges
4. No system files are modified
USB Block Script:
@echo off
reg add "HKLM\SYSTEM\CurrentControlSet\Services\USBSTOR" /v Start /t REG_DWORD /d 4 /f
USB Unblock Script:
@echo off
reg add "HKLM\SYSTEM\CurrentControlSet\Services\USBSTOR" /v Start /t REG_DWORD /d 3 /f