About this error
When you try to use Diskpart to format or clean USB drive or SD card, you may find
that this operation fails followed by error message below.
Diskpart has encountered an error: Access is denied.
See the System
Event Log for more information.

If you see the System Event Log, you might get something like “Failed to open device
\\?\GLOBALROOT\Device\HarddiskVolume5. Error code: [email protected]”. It means that the
storage device is considered to be blocked, write-protected or unauthorized. In this
case, Diskpart clean or format command cannot be properly completed.
Diskpart has encountered an error access is denied in Windows 7/8/10 – how to
fix?
As mentioned above, if you receive an error message: “Diskpart has encountered an
error access is denied” when formatting or cleaning USB drive or SD card, your
device may be unauthorized or blocked.
See below, find the causes in System Event Log and fix this error.
Fixed - Diskpart has encountered an error access is denied on USB drive or SD
card
Step 1. See the System Event Log for more information.
1. Press Win + R to summon the Run windows,
type eventvwr and press Enter.
2. Click Windows Logs and
System in order.
3. Look for errors with RED Exclamation
mark and check the details information.

Step 2. Run cmd as administrator.
1. Type cmd in the search box,
right-click it and select Run as administrator from the
context menu.
2. Type diskpart in the command prompt and
press Enter.
3. Try Diskpart format command or Diskpart clean command again
and check if this error will occur during the process.
Fixed - Diskpart has encountered an error access is denied using format/clean
command
Besides authorization issue, write-protection can be one of the reasons which will
lead to this error.
You can try to remove
write-protection from USB drive or SD card and then try diskpart commands again.
Step 1. Type regedit in the Run window.
Step 2. Navigate to the following subkey.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies
Step 3. Double-click the WriteProtect key
and change the value to 0. If there is not writeProtect key,
you can create a new one and set its value to 0.
Step 4. Open cmd and try Diskpart commands again.
Tested way to fix Diskpart has encountered an error access is denied
In general, you can use Diskpart to do many things, such as, format file system
between NTFS and FAT32, convert disk between GPT and MBR, and more. However,
sometimes, it may not work as normal. And it will tell you the corresponding error
message, which gives you a clue to find the causes and solutions.
“Diskpart has encountered an error access is denied” is one of the error messages you
may meet when you use Diskpart. If the above way does not fix your probem, there is
no need to spend much time in fixing Diskpart has encountered an error.
If you want to format or clean USB or SD card in a very short time, you can try an
alternative software like AOMEI Partition
Assistant. This software has both free and paid version. For this error,
free version is enough. But if your problems cannot be solved by this version, you
can upgrade to paid version, including AOMEI Partition Assistant
Professional, AOMEI Partition Assistant Server.
Step 1. Download third
party software, Install and run it.
Step 2. Right-click the drive that you want to format and
choose Format Partition.

Step 3. Input Partition Label, select the file system, cluster size
and then click OK to exit this window.

Step 4. Click Apply and
Proceed to start the pending operation.

Besides Diskpart has encountered an error access is denied, AOMEI Partition Assistant
Standard, free version of partition manager, can also help you fix other peoblems,
such as, virtual
disk service error the volume size is too big, specified disk not
convertible, Windows was unable to complete the format, Diskpart
list volume there are no volumes, etc.