Enable USB Ports from the Command Line: Commands and Keyboard Recovery
Re-enabling USB depends on how it was disabled. A registry value, a policy entry and a disabled device each have their own undo. This page lists them in the order most people need them, and covers the awkward case where the keyboard stopped too.
Set the USBSTOR Start value back to 3, delete the Deny_All policy value if present, and restart. For a single disabled device, run pnputil /enable-device with its instance ID. If the keyboard is dead, make the change from Safe Mode or the recovery command prompt.
First, find the cause
Match the undo to the way USB was disabled
There is no single enable command, because there is no single disable command. Identify which layer is active, then reverse that layer. Reversing the wrong one leaves the block in place and wastes a restart.
| How it was blocked | What to run | Restart? |
|---|---|---|
| USBSTOR Start = 4 | reg add ... /v Start /d 3 | Yes |
| Deny_All policy value | reg delete ... /v Deny_All /f | Yes |
| Device disabled with pnputil | pnputil /enable-device | Usually no |
| Device disabled in Device Manager | Enable device from its menu | No |
| Port off in BIOS or UEFI | Firmware setup screen | Yes |
| Third-party software | That program’s unlock route | Depends |
Not sure which applies? Run the checks below. They only read values, so they are safe at any time.
reg query HKLM\SYSTEM\CurrentControlSet\Services\USBSTOR /v Start
reg query "HKLM\SOFTWARE\Policies\Microsoft\Windows\RemovableStorageDevices"
pnputil /enum-devices /disabledThe first line shows the driver start type, the second lists any removable-storage policy values, and the third lists devices currently disabled.
The commands
Reverse each method with one command
Each reversal is a single line. Run it from an elevated prompt, restart where the table says to, and finish with a spare-drive test to prove the port works again.
Restore the USBSTOR driver
reg add HKLM\SYSTEM\CurrentControlSet\Services\USBSTOR /v Start /t REG_DWORD /d 3 /fThe value 3 is the default, meaning the driver starts on demand. PowerShell equivalent:
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\USBSTOR" -Name "Start" -Value 3Remove the removable-storage policy value
reg delete "HKLM\SOFTWARE\Policies\Microsoft\Windows\RemovableStorageDevices" /v Deny_All /f
gpupdate /forceIf Group Policy or a management tool sets the value, it can return at the next refresh. In that case the fix belongs where the policy is defined.
Bring back a disabled device
pnputil /enum-devices /disabled
pnputil /enable-device "<instance ID from the list>"Get-PnpDevice -PresentOnly | Where-Object Status -eq 'Error'
Enable-PnpDevice -InstanceId '<instance ID>' -Confirm:$falseMicrosoft’s documentation says Disable-PnpDevice and its enable counterpart need an administrator account, which is why standard users cannot reverse these changes.
The awkward case
When the keyboard and mouse stopped working too
Losing the keyboard usually means a USB controller or root hub was disabled, not that storage was blocked. Fix it from outside the running system: Safe Mode, or the recovery command prompt with the system registry loaded offline.
Try the easy routes first
- A PS/2 keyboard, if the PC has the port.
- A different USB port that sits on another controller.
- A touch screen, or the on-screen keyboard on the sign-in screen.
- Remote management tools you enabled earlier.
Offline registry edit from the recovery command prompt
Boot to the Windows recovery environment, open Command Prompt, and find the Windows drive letter first. It is often not C: in recovery.
reg load HKLM\OFFSYS D:\Windows\System32\config\SYSTEM
reg add HKLM\OFFSYS\ControlSet001\Services\USBSTOR /v Start /t REG_DWORD /d 3 /f
reg unload HKLM\OFFSYSReplace D: with the letter that holds your Windows folder. Writing to the wrong drive changes nothing useful, and the keyboard stays dead.
A disabled controller needs a different fix: boot to Safe Mode and re-enable it in Device Manager, or use the device commands above once any input works. The same rule applies on this site’s mistakes list: never disable root hubs on a PC you cannot reach.
Finish properly
Test the result before you walk away
Plug in a spare drive, confirm it appears in File Explorer, and check that keyboard, mouse and any phone connections respond. A short test now beats a surprise during the next meeting.
- RestartUse Restart so the driver set reloads.
- Plug in a driveIt should receive a drive letter within seconds.
- Check Device ManagerNo warning icons under Disk drives or Universal Serial Bus controllers.
- Re-block if neededIf this was a test, the blocking commands are on the main guide.
If the drive still refuses to mount after you reversed everything, the reverse of the common problem applies: see why USB behaves differently from the setting for how to read which driver owns the device.
Next step
Want a switch instead of a registry edit?
Typing commands each time is slow. A program with a password-protected on and off switch makes the same change in a click, and logs attempts.
When a built-in command is not enough, our own tool, USB Block, adds a password and an allow list. Our editorial pick and its limits are laid out in the recommendation section on the main guide.
Common questions
Questions about enabling USB from the command line
How do I enable USB ports from the command line?
Open an elevated Command Prompt and run reg add with the USBSTOR Start value set to 3, delete the Deny_All value if you wrote one, and restart. For a single disabled device, pnputil /enable-device or Enable-PnpDevice brings it back without a restart in most cases.
My keyboard stopped working. How do I fix it without typing?
Boot into the Windows recovery environment or Safe Mode and make the change there. If no USB keyboard works, a PS/2 keyboard, a touch screen, or an on-screen keyboard in recovery may still accept input. The offline registry steps on this page work from the recovery command prompt.
Which command re-enables a device I disabled with pnputil?
Use pnputil /enable-device with the same instance ID you disabled, or Enable-PnpDevice in PowerShell. List devices first with pnputil /enum-devices to find the ID, including disabled ones, since a disabled device still appears in that list.
Do I need to restart after enabling USB again?
Restart after changing the USBSTOR value or deleting the policy value, because the driver set loads at start. Device-level enables usually take effect immediately without one. When in doubt, restart once and test with a spare drive to be sure.
What if USB Block or another tool locked the ports?
Use that tool’s own unlock or uninstall route with its password, instead of editing the registry underneath it. Software that enforces its own rule may reapply it, so a manual registry fix can be undone at the next start of the program.
Can a standard user enable USB again?
No. Every method here needs administrator rights, so a standard account cannot undo a block set by an administrator. On a managed work or school PC, ask whoever controls the policy to change it for you, or to approve an exception.