See Our Top Pick →
Terminal window with a reg add command that sets the USBSTOR service to disabled, next to a USB port with a no-entry mark> reg add HKLM\SYSTEM\ CurrentControlSet\Services\ USBSTOR /v Start /t REG_DWORD /d 4 /fThe operation completedsuccessfully.Storage: blockedKeyboard: allowedMouse: allowedUSB DRIVE: DENIED

How to Disable USB Ports from the Command Line: Step-by-Step Guide 2026

No single command switches off a USB port. A command can stop Windows from loading the storage driver, deny removable storage by policy, or disable chosen device entries, and each of those blocks a different set of devices. This guide covers Windows 10 and 11, shows what every command leaves working, and gives the rollback for each.

NewSoftwares.net editorial teamPublished November 2026Last verified: November 202611 min read
Quick answer

Run reg add HKLM\SYSTEM\CurrentControlSet\Services\USBSTOR /v Start /t REG_DWORD /d 4 /f from an elevated Command Prompt, then restart. Windows stops loading the USB storage driver, so flash drives and external disks no longer mount. Keyboards and mice keep working. Phones need a separate policy.

At a glance
Applies toWindows 10 and Windows 11, all editions for the registry command
Time neededAbout 5 minutes plus one restart
DifficultyModerate: administrator rights and a registry edit
CostFree, built-in commands
Needs admin or internetAdmin: yes. Internet: no
Last verifiedNovember 2026

The short version

How to Disable USB Ports from the Command Line: Quick Answer

To disable USB storage from the command line on Windows 10 or 11, run an elevated reg add that sets the USBSTOR service Start value to 4, then restart. Keyboards, mice and hubs keep working because only the mass-storage driver is switched off.

Three command-line routes exist, and they differ in what they stop. The USBSTOR value stops storage drives. The Removable Storage Access policy value stops removable storage classes, including optical drives. The pnputil and PowerShell device commands stop whichever devices you name. None of them powers a port off; for that you need a BIOS or UEFI setting.

If you only need to stop flash drives and external disks

Use the USBSTOR value. It is one line, works on Home and Pro, and reverses by setting the value back to 3. The full command and its PowerShell twin are in the step-by-step section below.

If phones and cameras must be blocked too

Phones and cameras connect as portable devices, not as USB drives, so the USBSTOR value does not cover them. The Windows Portable Devices (WPD) deny policies do. Reports on Microsoft’s Q&A site describe phones staying readable under the general deny policy until the WPD settings were enabled.

If several PCs need the same rule

Set the policy once in Group Policy or your device-management tool instead of typing commands on each machine. The comparison table further down shows where each method fits.

Pick your path:

Before you type anything

Requirements and rollback plan before you change USB settings

You need an administrator account, Windows 10 or 11, a spare USB drive for testing and about five minutes. The registry and device commands in this guide are all blocked for standard users, so run every command from an elevated prompt.

Rollback-first rule in three steps: export the key, change one value, test with a spare drive1. ExportSave the key to a .reg file2. Change one valueSet Start to 4, nothing else3. TestSpare drive, then restart
The rollback-first rule: export, change one value, test.

The rollback-first rule

  1. Export the key you are about to change to a .reg file.
  2. Change one value only, and write down its old data.
  3. Restart, then test with the spare drive before you leave the machine.

Microsoft’s archived guidance on blocking USB storage warns that serious problems can follow if the registry is edited incorrectly, and tells you to back up the registry first. Export the single key rather than the whole registry; it restores in seconds.

The case for blocking

Why Block USB Ports at All

USB storage moves data in both directions. A drive can carry files out of a PC without leaving a trace in email logs, and it can carry malware in. Blocking storage at the driver removes both paths on that machine.

USB data theft and insider-risk basics

A flash drive holds hundreds of gigabytes in a pocket, and copying takes seconds. Shared PCs, front-desk machines and anything holding client or financial files carry the highest exposure. Blocking storage does not stop screenshots or cloud uploads, so treat it as one control among several.

How malware reaches a PC through a USB drive

A drive can carry an infected document or program that runs the moment someone opens it. Drives also move between home and work machines, so one careless plug-in can reach several systems. How-To Geek notes that delivering malware through USB devices is relatively common, which is why blocking removable storage appears in so many security baselines.

Risk score card: is your PC exposed through USB?

Tick everything that applies
Exposure: Low (0 of 11 points)

Few open paths. A single storage rule and a spare-drive test is enough for now.

The commands

Step-by-Step: Disable USB Ports from the Command Line

Three command-line methods cover most cases: setting the USBSTOR start type, writing the Removable Storage Access policy value, and disabling devices with pnputil or PowerShell. Run each from an elevated prompt. The first two change rules; the third changes devices.

Method 1: set the USBSTOR start type

USBSTOR is the Windows service that drives USB mass-storage devices. Microsoft’s documentation says setting its Start value to 4 stops an already-installed USB storage device from working when a user connects it. The default value is 3, which means start on demand.

  1. Open an elevated prompt.Right-click Start and choose Terminal (Admin), or search for cmd and pick Run as administrator.
  2. Export the key as a backup.
    Command Prompt
    reg export HKLM\SYSTEM\CurrentControlSet\Services\USBSTOR C:\usbstor-backup.reg
  3. Set Start to 4.
    Command Prompt
    reg add HKLM\SYSTEM\CurrentControlSet\Services\USBSTOR /v Start /t REG_DWORD /d 4 /f
    Windows answers “The operation completed successfully.”
  4. Restart Windows.How-To Geek tells readers to restart for the change to apply on Windows 11, and a restart also clears any driver already loaded for a mounted drive.

The PowerShell form does the same thing and is easy to wrap in a script:

PowerShell (admin)
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\USBSTOR" -Name "Start" -Value 4

Microsoft’s archived article splits the problem. If a USB storage device is already installed, set Start to 4. If none has been installed yet, it suggests denying permissions on the Usbstor.inf and Usbstor.pnf files in the Inf folder, which stops the driver from installing at all. The second route changes file permissions, including for SYSTEM, so it carries more side effects.

Method 2: write the Removable Storage Access policy value

The Group Policy setting All Removable Storage classes: Deny all access stores its choice as a registry value named Deny_All under the policies key. Microsoft’s ADMX reference documents that key path, and NinjaOne documents the DWORD value. Writing it by command gives you the policy effect without opening an editor.

Command Prompt (admin)
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\RemovableStorageDevices" /v Deny_All /t REG_DWORD /d 1 /f

Microsoft’s device-management blog notes that if no forced reboot is configured, the access right does not take effect until the operating system restarts, so plan for a restart here too.

Method 3: disable devices with pnputil or PowerShell

pnputil ships in every Windows release, and its disable-device switch has existed since Windows 10 version 2004. Microsoft recommends pnputil over the older DevCon tool. List first, then disable by hardware or compatible ID. Never target the keyboard class.

Command Prompt (admin)
pnputil /enum-devices /connected /class USB
pnputil /disable-device /deviceid "USB\Class_08"
PowerShell (admin)
Get-PnpDevice -Class USB -PresentOnly
Disable-PnpDevice -InstanceId '<instance ID from the list>' -Confirm:$false

Disabling by device entry acts on the devices Windows already knows. A different drive with its own instance ID may be installed fresh, so treat this method as a precise tool, not a blanket rule.

Do not disable the USB root hub or every entry under Universal Serial Bus controllers on a PC you cannot physically reach. The keyboard and mouse usually sit behind those entries, and you can lose local input.

Side by side

Built-in Windows Methods Compared

Five built-in routes block USB in different places, from a BIOS switch that turns a port off to a policy that denies one class of device. The table shows scope, edition limits, whether a restart is needed and how each one reverses.

Five blocking layers from the broadest, a BIOS setting, to the narrowest, a Removable Storage Access policyBIOS or UEFI settingAll ports, every device classDevice installation policyNew devices, matched by ID or classDevice Manager or pnputilOne device, or one classUSBSTOR start typeMass-storage driver onlyRemovable Storage Access policyRead, write, execute per class
Five blocking layers, broadest at the top and narrowest at the bottom.
Built-in methods to block USB on Windows
MethodWhat it stopsEditionsRestartHow to reverseLeaves working
USBSTOR Start = 4USB mass-storage driverAll, registry access onlyAdvisedSet Start to 3Keyboards, mice, printers
Deny_All policy valueRemovable storage classesGroup Policy editor on Pro, Enterprise, Education; registry on allNeeded unless a forced reboot is setDelete the valueInput devices
pnputil or Disable-PnpDeviceOnly the devices you nameWindows 10 version 2004 and later for pnputilUsually notEnable-device or Enable-PnpDeviceEvery device you did not name
Device Manager, disable a controllerEverything behind that controllerAllNoEnable deviceDevices on other controllers
BIOS or UEFI settingThe whole portHardware dependentYesChange the firmware settingNothing on that port
VerdictStart with the USBSTOR value for storage onlyUse the policy value when phones or optical drives matter

Choosing a route

Best Free Methods to Disable USB Ports from the Command Line

Of the free routes, the USBSTOR value suits one PC, the Removable Storage policy suits a group of PCs, and pnputil suits one known device. The picker below maps your Windows edition, PC count and phone needs to a single route.

USB block method picker

Which Windows edition?
How many PCs?
Do phones need blocking too?
Suggested route

Registry command or Group Policy. Either works on a single Pro PC. The Group Policy route is easier to read later; the command is faster to script.

The free methods share one limit: none of them has a password. Anyone with administrator rights can set Start back to 3 in a minute. If a family member or colleague has admin rights, a password-protected tool or a standard-user account is the stronger fix.

What gets blocked

USB device classes: what each command touches

USB devices announce a class, and the blocking commands act on classes, not on physical ports. Mass storage uses class 08, keyboards and mice use the HID class 03, and phones appear as portable devices. Knowing the class tells you whether a command will reach the device.

One USB port feeding four device classes with the rule that governs each classMass storage (class 08)USBSTOR start type, Removable Disks policyPortable devices (phones, cameras)WPD Devices policyPrinters (class 07)Not touched by storage rulesKeyboards and mice (HID, class 03)Not touched by storage rules
One port can carry several device classes, each governed by its own rule.
USB device classes and the commands that reach them
Device classExamplesUSBSTOR Start = 4Removable Storage policyNote
Mass storageFlash drives, external disks, card readersBlockedBlocked (Removable Disks)Standard drives use USBSTOR
USB Attached SCSI drivesFast external SSDsMay not be coveredTest itWindows uses a separate UASPStor driver for UAS
Portable devices (WPD)Phones, cameras, media playersNot coveredOnly with the WPD Devices policiesPhones use MTP or PTP, not USBSTOR
Optical and floppyUSB DVD drivesNot coveredBlocked with all-classes or CD and DVD policiesSeparate policy entries exist
Human interfaceKeyboards, miceLeft workingLeft workingNever block this class by accident
PrintersUSB printersLeft workingLeft workingSeparate driver

How USB port blocking differs from disabling a single device

Blocking a class stops every device of that type on every port. Disabling a device stops one device entry, identified by its instance ID. A class block is a rule about types; a device disable is an action on one thing.

Class block
A policy or driver setting such as USBSTOR Start = 4. New devices of that class are refused automatically.
Device disable
A pnputil or PowerShell action on a named device. It does not cover other devices that appear later.
Port off
A firmware setting. It stops every device on that port, including keyboards, which is why BIOS-level blocking is rare on desktops you use daily.

Allow keyboard/mouse while blocking storage

The USBSTOR value and the Removable Storage policy both leave the HID class alone, so input keeps working. The trouble starts when you disable controllers or hubs, or when you use the install-restriction policies without allowing the keyboard, mouse and USB bus classes. The walkthrough for approved drives lists those class entries.

Three approaches

Group Policy vs registry vs software-based control

Group Policy writes the same registry values as the commands, but through an editor that documents each setting. The registry route is the quickest to script. Software adds a password, an allow list screen and activity reports that neither built-in route offers.

Group Policy, registry and software compared
ApproachWhere you run itEditionStrengthWeakness
Registry commandElevated prompt or scriptAll editionsFast, scriptable, no editor neededNo password; admins can reverse it
Group PolicyLocal editor or domain policyPro, Enterprise, EducationDocumented settings, central deploymentEditor missing on Home
SoftwareA program on each PCWindows versions the vendor listsPassword, allow list, reportsAnother program to install and maintain

The Local Group Policy Editor (gpedit.msc) is part of Windows Pro, Enterprise and Education. Typing gpedit.msc on Windows Home returns a “cannot find” error. Check your edition under Settings, System, About before choosing the policy route.

Policy rollout checklist for multi-PC offices

0 of 6 completed

Office USB policy generator

Choose what to include
Generated .bat script
@echo off
rem Run from an elevated Command Prompt. Export the key first: reg export HKLM\SYSTEM\CurrentControlSet\Services\USBSTOR usbstor-backup.reg
reg add HKLM\SYSTEM\CurrentControlSet\Services\USBSTOR /v Start /t REG_DWORD /d 4 /f

rem --- Rollback (run to undo) ---
rem reg add HKLM\SYSTEM\CurrentControlSet\Services\USBSTOR /v Start /t REG_DWORD /d 3 /f
rem reg delete HKLM\SOFTWARE\Policies\Microsoft\Windows\RemovableStorageDevices /v Deny_All /f
rem Restart, then test with a spare drive.

Exceptions

How to Allow Approved Drives Only

Windows can block every USB device that no policy describes and then allow named devices by hardware ID or instance ID. Done correctly, one company drive works and every other drive is refused, while the keyboard and mouse stay allowed through their device classes.

The setting names live under Device Installation Restrictions in Group Policy. Keyboards and USB hubs need explicit allow entries, or the block can reach them as well. Full walkthrough: allow only one approved USB drive.

Proof

How to Verify It Worked After You Disable USB Ports from the Command Line

Verification takes four checks: read the registry value, restart, plug in a spare drive, and look at Device Manager and the event log. A rule you have not tested with a real drive is only an assumption.

Four verification steps in order: query the value, plug in a spare drive, open Device Manager, read the event log01Query the value02Plug in a spare drive03Open Device Manager04Read the event log
Four checks, in the order to run them.
Command Prompt
reg query HKLM\SYSTEM\CurrentControlSet\Services\USBSTOR /v Start
sc qc USBSTOR

The first command should print Start with the data 0x4. The second shows the service configuration, where the start type reads 4 DISABLED when the block is active.

Verification checklist

0 of 5 completed

If you turned on Audit PNP Activity, Windows logs event 6416 each time it recognises a new external device. Microsoft documents that event, and its presence tells you the system saw the plug-in even when the block refused to mount it.

Avoid these

Common Mistakes When You Disable USB Ports from the Command Line

Most failed attempts come from five mistakes: no backup, the wrong control set, disabling a hub that carries the keyboard, testing with an already-mounted drive, and skipping the restart. Each has a simple prevention.

Do this

  • Export the key before the change
  • Edit CurrentControlSet, the active set
  • Test with a drive that was never plugged in
  • Restart, then test again
  • Keep the reversing command in a text file

Not that

  • Change values from memory with no backup
  • Edit a numbered ControlSet that is not active
  • Judge success from a drive that is already mounted
  • Disable root hubs on a remote PC
  • Apply to every PC on day one

Changing ControlSet001 and assuming it applies. CurrentControlSet is a pointer to the active set, and a forum thread on Windows 11 describes a user who edited several sets and still saw drives mount, which points to a second cause worth checking.

When it does not take

Troubleshooting: USB still works after the command

A drive that still mounts after Start is set to 4 usually points to one of four causes: it was mounted before the restart, it uses the UAS driver, it is a phone using the portable device stack, or a policy rewrote the value. Check them in that order.

USB block troubleshooting
ProblemLikely causeFix
Drive still appearsDrive was mounted before restartRestart, unplug, plug in again
Fast external SSD still worksUAS drive uses a separate driverUse the Removable Storage policy and test
Phone files still openPhones use the portable device stackEnable the WPD Devices deny policies
Value is back to 3Another policy or tool resets itCheck device-management and security software
Keyboard stopped workingA hub or controller was disabledBoot to Safe Mode, re-enable the device

The full diagnostic walkthrough, with commands for each cause, is in USBSTOR Start value 4 but USB still works. If the keyboard itself went dead, jump to enabling USB ports from the command line.

Undo

How to Re-enable USB Ports Safely

To undo the USBSTOR change, run reg add with Start set to 3 from an elevated prompt, delete the Deny_All value if you wrote it, and restart. Do this on a machine you own or administer; on a managed PC, ask the administrator.

Command Prompt (admin)
reg add HKLM\SYSTEM\CurrentControlSet\Services\USBSTOR /v Start /t REG_DWORD /d 3 /f

The device commands, the policy value and the keyboard-lockout case have their own page: how to enable USB ports from the command line.

Beyond the command

Is This Enough? What Else to Do After You Disable USB Ports from the Command Line

Blocking storage closes one door. It does not log attempts, does not stop a device posing as a keyboard, and has no password. Add auditing, standard accounts and, where drives must be used, encryption of the drive’s contents.

Logging and auditing USB device activity

Turn on the Audit PNP Activity subcategory and Windows writes event 6416 when it recognises an external device. Microsoft’s event reference also lists 6419 for a request to disable a device and 6420 and 6422 for a device that was disabled or enabled. Those events show who changed a device and when.

Passwords, standard accounts and drive encryption

The commands in this guide add no password. People ask on Microsoft’s forum whether Windows can put a password on USB ports, and the built-in options here do not. If the aim is to protect a drive’s contents instead, drive-level tools such as USB Secure’s password protection for USB drives take a different approach, and roundups like this list of USB password protection tools compare the field.

Where blocking software and reviews fit

Independent roundups such as this free USB blocking software list and this USB port locking tools review compare tools by feature, which helps if your needs outgrow the built-in commands.

Editorial pick

When commands are not enough: where USB Block fits

The commands above cannot give you a password-protected switch, an allow list you can edit on screen, or a report of blocked attempts. For those, we recommend USB Block’s blocking and allow-list features, our own product, with the limits listed below.

Based on the product’s documented features, USB Block blocks storage that appears as a drive, which its page lists as USB flash drives, external hard drives, SD cards, cameras and phones. It also covers CDs, DVDs, mapped network drives and non-system drives, lets you whitelist your own drives, asks for a password before an unauthorised device opens, and logs wrong-password attempts.

Installation needs administrator rights, and once installed the protection applies to every user on the PC.

USB Block red product box labelled Data Leak Prevention from NewSoftwares.net
USB Block product box.
  • Windows only. The product page lists 32-bit and 64-bit Windows 10, 8 and 7 plus Windows Server 2008, 2012, 2016 and 2019. Windows 11 is not named on that page, so test before you rely on it.
  • The page says USB Block is not antivirus.
  • The page prints no price or trial terms.
USB Block Detailed Summary tab showing USB devices allowed and disc drives blocked with a no-entry symbol
The Detailed Summary tab in USB Block, as shown on the official product pages.

Step by step

Software-Based USB Blocking Step-by-Step

Using a dedicated blocker takes six steps: download the installer from the official page, install it as administrator, set a password, tick the devices to block, authorise your own drives, and read the reports. The screens below follow the program’s documented tabs.

  1. Download the installer.Get it from the official NewSoftwares downloads page so the file is the vendor’s own build.
  2. Install with an administrator account.The product page states that administrator rights are required.
  3. Set a password.USB Block asks for one, and the page says it must be entered before an unauthorised device can be opened.
  4. Open Control Center and tick Block USB Devices.The description beside the switch reads “Stop unauthorized USB drives, external drives and memory cards.”
  5. Authorise your own drives.The Authorized Devices tab lists devices that work without a prompt.
  6. Review Reports and Logs.The tab records device activity, and the page says incorrect passwords are logged.
USB Block Control Center with switches to block USB devices, discs, network access and non-system drives
Control Center switches, from the official product screenshots (version shown may be older).

USB Block versus built-in commands versus endpoint management

Feature comparison
FeatureRegistry commandGroup PolicyUSB BlockDefender for Endpoint device control
Password-protected switchNoNoYes, per product pageManaged through admin roles
Allow list of approved devicesNoBy device IDYes, per product pageYes
Activity reportsOnly with audit policyOnly with audit policyReports and logs tabYes, in its console
PlatformWindowsWindows Pro, Enterprise, EducationWindowsWindows with Defender for Endpoint
CostFreeIncluded in editionsPaid, see storeNeeds Defender for Endpoint
VerdictFastest for one PCBest for managed groupsBest when you need a password and a logBest when you already run Defender for Endpoint

Reference

What USB Block does and does not do

USB Block is a Windows program that blocks storage devices, optical discs, network drives and non-system drives, with a whitelist and a password. It is a better fit for a shared PC than for a single locked-down kiosk image managed by policy.

Block storage devices

Flash drives, external disks, SD cards, cameras and phones that appear as drives.

Best for: shared PCs. Not ideal for: phones that use MTP, so test yours.

Whitelist your own drives

Approved devices work without a prompt.

Best for: one company drive. Not ideal for: large fleets managed centrally.

Password and logging

A password gates unauthorised devices and wrong attempts are logged.

Best for: homes and small offices. Not ideal for: audit trails sent to a central server.

USB Block Reports and Logs tab with device report and usage report tables
The Reports and Logs tab.

Cost

Cost of USB Block: what the official page shows

The commands in this guide cost nothing. USB Block is paid software, and its product page shows a Buy Full Version button without printing a price or a trial length, so this guide does not either. Prices and license options are on the NewSoftwares store.

Free versus paid options
OptionCostWhat you getLimit
Registry or policy commands$0Storage blocking on any editionNo password, no reports
USB BlockSee storeBlocking, whitelist, password, logsWindows only; Windows 11 not named on the page

Is it worth paying? If the PC is yours alone, the commands are enough. If other people share it and have admin rights, a password and a log are the features that justify a purchase.

USB Block Program Options tab with stealth mode, password and hack attempt monitoring settings
Program Options holds the password and monitoring settings.

Decision guide

Which blocking method fits a home PC, a shared PC or an office

A single home PC needs only the registry command. A shared PC needs a password-protected tool or standard accounts. A managed office needs Group Policy or device management, with software as an extra layer where policy cannot reach.

Recommended method by situation
SituationRecommended methodDoes USB Block fit?Honest alternative
One home PC, you are the only userUSBSTOR registry commandNot neededRegistry command
Family PC with several accountsStandard accounts plus blockingYes, for the passwordGroup Policy on Pro
Office of 5 to 20 PCsGroup Policy or softwareYes, if PCs are not domain joinedGroup Policy
Domain-joined fleetGroup Policy or device managementRarelyIntune or Defender device control
Developers who need USB devicesAllow list by device IDPartlyInstall-restriction policies

Common questions

Frequently asked questions about disabling USB ports from the command line

How to disable usb ports from the command line?

Open an elevated Command Prompt and run the reg add command that sets the USBSTOR service Start value to 4, then restart Windows. Storage drives stop mounting while keyboards and mice keep working. For phones, add the WPD Devices deny policies, because phones do not use the USBSTOR driver.

Can I disable usb ports from the command line without paid software?

Yes. Windows ships everything needed: reg add, PowerShell’s Set-ItemProperty and Disable-PnpDevice, and pnputil on Windows 10 version 2004 or later. Paid software only adds a password-protected switch, an allow list with a friendly screen, and activity reports. The built-in commands cost nothing and work offline.

What is the fastest way to disable usb ports from the command line?

Setting the USBSTOR start type is fastest: one reg add line, one restart, no editor to open. It takes under a minute on a PC you can reach. Group Policy is quicker for a hundred PCs, since you set it once and every machine in the group receives it.

What mistakes should I avoid when I disable usb ports from the command line?

Skipping the backup is the common one, followed by editing the wrong control set, disabling a USB root hub that carries your keyboard, and testing only with a drive that was already mounted. Export the key first, change one value, then test with a spare drive after a restart.

How do I check that it worked after I disable usb ports from the command line?

Run reg query on the USBSTOR key and confirm Start shows 0x4. Then restart, plug in a spare drive, and check that no drive letter appears in File Explorer. Device Manager normally lists the drive with a warning icon instead of a working disk entry.

Can I block USB storage but keep my keyboard and mouse working?

Yes, and the USBSTOR method does exactly that. It switches off only the mass-storage driver, so keyboards and mice, which use the HID class, are untouched. The risky choice is disabling a USB root hub or controller, which can cut off every device behind it, including your input devices.

Does blocking USB ports stop phone charging?

No. Charging comes from port power, and none of the storage commands in this guide cut it. A phone plugged in only to charge will still charge. What changes is file access: with the WPD Devices policies enabled, Windows will not let you browse the phone’s storage over USB.

Will USB blocking work on Windows Home?

The USBSTOR registry command works on Windows Home because it needs only the registry. The Local Group Policy Editor does not exist on Home, so the policy method has no editor there. Microsoft does not document whether Home enforces the policy key when you write it directly, so test it first.

How do I re-enable USB ports as the administrator?

Run reg add with Start set back to 3, delete the Deny_All value if you added it, and restart. Use an elevated prompt. If the keyboard is also dead, boot into the Windows recovery environment or Safe Mode and make the change from there.

Can I allow only one approved USB drive?

Yes, with device installation policies. You block devices no rule describes, then allow the approved drive by its device ID and allow keyboard, mouse and USB bus classes so input keeps working. Software with an allow list does the same job through a screen instead of policy settings.

Is it safe to edit the USBSTOR registry value?

It is safe when you back up first and change only the Start value. Microsoft’s own guidance warns that wrong registry edits can cause serious problems, so export the key to a .reg file before you begin. If something goes wrong, double-clicking the exported file restores the original.

Can I disable USB ports without administrator rights?

No. Every method here writes to protected registry keys or changes device state, and Microsoft’s documentation says Disable-PnpDevice needs an administrator account. A standard user cannot block USB on their own PC. On a work or school PC, ask whoever manages it.

Do these commands stop a USB device that pretends to be a keyboard?

No. A device that identifies itself as a keyboard uses the HID class, which the storage commands deliberately leave alone. Stopping that takes device installation policies that allow only known device IDs, or a physical measure such as locking the port. Storage blocking addresses data copying, not every USB attack.

More detail

In-depth answers on command-line USB blocking

Can you disable USB ports from the command line?

You can disable USB storage and chosen devices from the command line, but not the physical ports. Powering a port off is a firmware job, and the commands here act on drivers, policies and device entries.

That distinction explains most confusion. A drive blocked by the USBSTOR value still draws power from the port, so a phone still charges. If a literal power-off is the goal, look in BIOS or UEFI settings.

What is the easiest way to disable USB ports from the command line?

The easiest way is the single reg add line that sets USBSTOR Start to 4. It needs no editor, no extra download and no knowledge of device IDs.

Copy it from the step-by-step commands section, run it as administrator, and restart. The method fails quietly for UAS drives and phones, which the troubleshooting table covers.

Disable USB ports from the command line for free

Every command in this guide is free to run. The reg add, PowerShell and pnputil tools all come with Windows itself, so no download, account or licence is involved at any step.

Free methods carry no password and no reports. If those matter, compare them with the paid option’s documented features before buying.

Disable USB ports from the command line in 2026

The commands in this guide were checked against Microsoft documentation in November 2026 and apply to current Windows 10 and Windows 11 builds. Microsoft’s archived article on USB storage notes that newer management routes such as Intune are generally preferred in managed environments.

For a single PC, the registry value remains valid. For a company fleet, policy or device management is easier to audit.

USB Blocking Software

USB blocking software adds three things the commands lack: a password, an allow list with a screen, and logs. Programs differ on which Windows versions they support, so read the vendor’s list before installing.

Roundups rank tools by features, and they date quickly. Treat any ranking as a starting point and confirm the Windows version and licence terms on the vendor’s own page.

Block USB

To block USB on Windows means stopping a class of devices, one named device, or a whole port. The wording is loose, so decide first whether you mean storage, phones or everything.

Storage is the usual target. The class table above shows which command reaches which device.

Block USB Software

When you choose block USB software, check four things: the Windows versions it lists, whether it needs administrator rights to install, whether it keeps an allow list, and whether it logs attempts.

USB Block’s page documents all four except Windows 11 support, which it does not name. Ask the vendor or test on a spare PC before deploying.

Our verdict

Our verdict: use the USBSTOR value first, add software when you need a password and a log

For most readers, the USBSTOR registry command is the right first step: it is free, reversible and leaves input devices alone. When other people have admin rights, or you need a password, an allow list and logs, a dedicated program is the sensible next layer.

We make USB Block, so weigh that when you read our recommendation. The commands in this guide are a legitimate answer on their own, and we have said where they fall short.

Get USB Block → Download USB Block for Windows →

Go deeper on a single problem

Go deeper

This guide is published by the NewSoftwares.net team, the developer of USB Block. It covers free and built-in options alongside our own. Questions about the product can go to the developer through the contact page.