How to disable USB devices using GPO

Last updated on:

USB ports are essential for peripheral connectivity, but in a corporate environment, they pose significant risks for data theft and malware introduction. Administrators often need to disable USB access using Group Policy Object (GPO) to maintain strict data compliance and protect the network from unauthorized hardware.

This article demonstrates two methods to disable USB ports using the Group Policy Management Console (GPMC) and PowerShell, and ManageEngine ADManager Plus.

  • GPMC
  • PowerShell
  • ADManager Plus
  • Native tools limitations
  • Benefits
  • Troubleshooting
  • FAQ
 

How to disable USB devices in GPO using GPMC

Prerequisites

How to restrict USB access with GPO using GPMC

  1. Open GPMC, right-click the target OU and select Create a GPO in this domain, and Link it here...
  2. Name the GPO and click OK.
  3. Right-click the new GPO and select Edit.
  4. Navigate to Computer Configuration > Policies > Administrative Templates > System > Removable Storage Access.
  5. Double-click All Removable Storage classes: Deny all access policy and set it to Enabled.
    The Group Policy Management Console (GPMC) with the All Removable Storage classes: Deny all access setting selected.

How to block USB device installation with GPO using GPMC

  1. In the same GPO, navigate to Computer Configuration > Policies > Administrative Templates > System > Device Installation > Device Installation Restrictions.
  2. Enable Prevent installation of devices that match any of these device IDs (or Device Setup Classes).
  3. Add the hardware IDs for the USB devices you wish to block.

How to allowlist USB device installation with GPO using GPMC

  1. In the same GPO, navigate to Computer Configuration > Policies > Administrative Templates > System > Device Installation > Device Installation Restrictions.
  2. Disable Prevent installation of devices that match any of these device IDs (or Device Setup Classes).
  3. Add the hardware IDs for the USB devices you wish to allowlist.

Close the editor when finished; changes will apply at the next refresh or logon/boot cycle. If you wish for your GPO changes to take effect immediately, run the "gpupdate /force" cmdlet to force update GPOs

How to disable USB devices with GPO using PowerShell

Prerequisites

  • Ensure the Remote Server Administration Tool (RSAT) and the GroupPolicy PowerShell module are installed in your admin workstation or management server.
  • Run PowerShell as an Administrator when logged into Windows Server as a Domain Administrator.
  • Import the GroupPolicy module by running:Import-Module GroupPolicy

How to restrict USB access with GPO using PowerShell

Use the following PowerShell script to restrict the ability to read or write to USB storage devices by modifying the registry settings within a GPO.

Import-Module GroupPolicy
$gpoName = "Disable USB Storage Access"
$targetOU = "OU=Workstations,DC=yourdomain,DC=com"
# Create and Link GPO if it doesn't exist
if (!(Get-GPO -Name $gpoName -ErrorAction SilentlyContinue)) { New-GPO -Name $gpoName }
New-GPLink -Name $gpoName -Target $targetOU -ErrorAction SilentlyContinue
# Deny all access to Removable Storage (Computer Configuration)
Set-GPRegistryValue -Name $gpoName `
-Key "HKLM\Software\Policies\Microsoft\Windows\RemovableStorageDevices" `
-ValueName "Deny_All" `
-Type DWord `
-Value 1

How to block USB device installation with GPO using PowerShell

The following PowerShelll script prevents Windows from installing drivers for USB devices and blocks any connection completely. This is useful to block USB devices that are not removable storage devices (for example, printers, speakers).

# Prevent installation of devices using drivers that match USB classes
Set-GPRegistryValue -Name $gpoName `
-Key "HKLM\Software\Policies\Microsoft\Windows\DeviceInstall\Restrictions" `
-ValueName "DenyDeviceClasses" `
-Type DWord `
-Value 1

How to allowlist devices with GPO using PowerShell

The following PowerShell script allows Windows to install specific devices even if a general "Deny" policy is in place. This is essential for ensuring that approved peripherals (like a specific model of an encrypted Kingston drive or a company-issued mouse) remain functional.

Set-GPRegistryValue -Name $gpoName `
-Key "HKLM\Software\Policies\Microsoft\Windows\DeviceInstall\Restrictions" `
-ValueName "AllowDeviceClasses" `
-Type DWord `
-Value 1

Supported parameters

Parameter Description
New-GPO
-Name Specifies the display name of the new GPO.
-Comment Adds an optional description to the GPO for documentation.
-Domain Specifies the domain where the GPO will be created.
-Server Specifies the domain controller to run the command against.
Set-GPRegistryValue
-Name / -Guid Identifies the target GPO by its display name or GUID.
-Key Specifies the registry key path inside the GPO (HKCU for user policies, HKLM for computer policies).
-ValueName Names t he registry value that represents the policy setting.
-Type Identifies the registry value type such as DWord, String, MultiString, ExpandString, etc.
-Value Represents the data to assign to the specified registry value in the GPO.
New-GPLink / Set-GPLink
-Target Displays the Distinguished Name (DN) of the site, domain, or OU to link the GPO.
-LinkEnabled Enables or disables the GPO link.
Registry values
Deny_All When set to "1", denies all read and write access to removable storage devices for the user or computer.
DenyDeviceClasses When set to "1", prevents Windows from installing drivers that match specified USB device setup classes.

How to disable USB devices with GPO using ADManager Plus

  1. Log in to ADManager Plus and navigate to the Management tab.
  2. In the left pane, click GPO Management.
  3. Under GPO Management, click Manage GPOs.
  4. In the Actions column of the GPO that you would like to edit, click the <edit>edit icon.
  5. Navigate to Computer Configuration > Policies > Administrative Templates > System > Removable Storage Access.
  6. Double-click All Removable Storage classes: Deny all access policy and set it to Enabled.
The All Removable Storage classes: Deny all access setting selected in the Manage GPO Settings task of ADManager Plus.

Note: To block USB device installations using ADManager Plus, follow the same steps until Step 4, and follow the same navigation as mentioned here.

Limitations of using native tools to edit GPOs

While powerful, relying solely on PowerShell and GPMC can present several challenges:

  • GPMC does not provide strong bulk-editing capabilities; changing the same setting across many GPOs requires repetitive manual effort.
  • PowerShell GPO cmdlets primarily target registry-based settings, making it more challenging to configure complex or preference-based policies compared to using a graphical interface.
  • PowerShell requires familiarity with the GroupPolicy module and scripting; mistakes in New-GPO or New-GPLink usage can result in GPOs being created in the wrong domain or linked incorrectly.
  • Native tools require specific admin privileges to edit GPOs, which can restrict delegation and increase reliance on privileged accounts.
  • Scripted changes must be carefully tested; mistakes in Set-GPRegistryValue or link operations can introduce misconfiguration at scale.

Benefits of using ADManager Plus to edit GPOs

ADManager Plus , an AD management and reporting solution, helps admins perform GPO management tasks with a script-free, easy to use interface.

How to verify if GPO to block USB devices is applied

After configuring your GPO, it is crucial to verify that the settings have successfully propagated to the end-user machines.

1. Force a Policy Update

On a client machine, open Command Prompt as an administrator and run the gpupdate /force cmdlet.

2. Use Resultant Set of Policy (RSOP)

Run rsop.msc on the client machine. This provides a graphical view of all policies currently applied to that specific computer and user. Look for the "Removable Storage Access" settings to ensure they are marked as Enabled.

3. Generate a GPResult Report

To see a detailed command-line report of which GPOs are being applied, use: gpresult /r

  • Check under Applied Group Policy Objects to see if your new USB policy is listed.

4. Registry Verification

Navigate to the following registry key to see if the GPO successfully changed the value to 1: HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\RemovableStorageDevices

  • Value Name:Deny_All
  • Value Data:1

Troubleshooting common errors

Error: Access is denied (when running PowerShell scripts).

Solution: Ensure you are running PowerShell as an Administrator and that the account used has "Domain Admin" or "Group Policy Creator Owner" privileges.

Error: GPO settings not appearing on the client machine.

Solution: Run gpupdate /force on the client. If it still fails, check for GPO inheritance blocks or verify that the computer is in the correct OU where the GPO is linked.

Error: USB keyboard/mouse stopped working after applying policy.

Solution: You have likely used a broad "Device Class" ID in the "Device Installation Restrictions" policy. Remove the generic USB class and specify only the "USB Storage" Class GUID: {53f5630d-b6bf-11d0-94f2-00a0c91efb8b}.

FAQ

Restricting USB access allows the port and device to be detected but limits what users can do, such as blocking read/write access to removable storage. Blocking USB devices prevents specific devices from being installed or used, meaning the system denies even minimal data transfers.

Yes. you can disable USB devices using GPOs for specific users by using Security Filtering with security groups or apply the GPO only to selected OUs.

No. GPO policies do not disable the USB ports or uninstall controllers. They block access or installation based on policy settings and is reversible.

Yes. You can use Device Installation Restrictions when blocking USB device installations to allow or block devices based on hardware IDs or setup classes. This enables granular control instead of a blanket block.

No. The Removable Storage Access GPO setting only targets storage devices such as pen drives and storage disks. Keyboards and mice are unaffected unless broader device installation restrictions are configured incorrectly.

Take the complexity out of GPO management using ADManager Plus

The one-stop solution to Active Directory Management and Reporting
Email Download Link Email the ADManager Plus download link