Diskpart Has Encountered an Error: Access Is Denied (3 Ways)

When you use diskpart to format or clean USB drive or SD card, you may receive Diskpart has encountered an error access is denied. Want to fix it? See this article.

Posted by @Dervish July 24, 2024 Updated By @Dervish June 20, 2024

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: 5@020A0019”. 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/11 – how to fix?

Why does diskpart has encountered an error? If you receive an error message: “Diskpart has encountered an error access is denied” when formatting or cleaning USB drive or SD card, it means that your command prompt doesn't have the privilege or the drive is write protected.

Continue reading and we provide the complete guide to the System Even Log. If you want to perform a hard disk formatting quickly, perform a disk cleanup, or create partitions, you can first use an alternative to Diskpart - AOMEI Partition Assistant. This tool has all the features of Diskpart and does not require complex commands. You can download it for free and have a quick look at it.

Download for FreeWin 11/10/8.1/8/7/XP
Secure Download

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 versions. For this error, free version is enough. But if this version cannot solve your problems, you can upgrade to the paid version, including AOMEI Partition Assistant Professional, and AOMEI Partition Assistant Server.

Step 1. Download third-party software, Install it, and run it.

Download for FreeWin 11/10/8.1/8/7/XP
Secure Download

Step 2. Right-click the drive that you want to format and click 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.

Have you solved the "Diskpart has encountered an error" issue? 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.