If you have been getting the error message “DiskPart has encountered an error: Access is denied” when trying to format or partition a disk, don’t worry – you’re not alone. This can be frustrating since it prevents you from using DiskPart Commands and doing anything with your disk.
Fortunately, it is a common problem that can be fixed fairly easily. In this article, we will walk you through the steps to fix the “DiskPart has encountered an error: Access is denied” error.
To fix various Windows 10/11 problems, we recommend Outbyte PC Repair:
This software will repair common computer errors, protect you from file loss, malware damage, hardware failure, and optimise your computer for peak performance. In three simple steps, you can resolve PC issues and remove virus damage:
- Download Outbyte PC Repair Software
- Click Start Scan to detect Windows 10/11 issues that may be causing PC issues.
- Click Repair All to fix issues with your computer's security and performance.
This month, Outbyte has been downloaded by 23,167 readers.
What is the “DiskPart has encountered an error: Access is denied” error?
DiskPart is a useful tool for managing computer disks. Even if the Windows 11/10 operating system’s graphical disk management tools fail, DiskPart always manages to function. This does not imply that it cannot encounter any difficulties. Due to various reasons, DiskPart can generate errors.
The “DiskPart has encountered an error: Access is denied” error usually occurs when you try to format or partition a disk. It can also occur when you try to clean a disk or convert it to a different file system.
The error message is pretty clear – DiskPart doesn’t have the necessary permissions to access the disk. This can happen for a number of reasons.
What are the causes of DiskPart Access Denied Error?
There are several reasons why the “DiskPart has encountered an error: Access is denied” error can occur:
- There are no Administrative rights. DiskPart needs to be run as an administrator in order for it to work properly. So, if you don’t have proper administrative rights, you won’t be able to use its commands.
- The disk is in use by another process. This can happen if you have any programs open that are using files on the disk. Try closing all open programs and try again.
- Disk is write-protected. Many USB flash drives and SD cards come with a physical switch that can be used to enable or disable write protection. Make sure that the switch is in the correct position.
- The disk is locked by BitLocker. BitLocker is a security feature that encrypts your data. If you try to format an encrypted drive, you will get the “DiskPart has encountered an error: Access is denied” error. To fix this, you need to decrypt the drive first.
How to Fix the “DiskPart has encountered an error: Access is denied” error?
There are a few different ways that you can fix the “DiskPart has encountered an error: Access is denied” error. We will go over each method in detail.
Run DiskPart as Administrator
One of the most common reasons for the “DiskPart has encountered an error: Access is denied” error is that you don’t have proper administrative rights. DiskPart needs to be run as an administrator in order for it to work properly.
To fix this, you need to open the Command Prompt as an administrator and then run the DiskPart commands. Here are the steps:
- Click on Start and type “cmd” in the Windows search bar.
- Right-click on the “Command Prompt” result and click on “Run as administrator”.
- Click on “Yes” when prompted by User Account Control.
- Type in the following command and press Enter: diskpart
You should now be able to use DiskPart without any problems.
Disable Write Protection
There are two ways to disable Write-Protection from a USB drive.
Turn Off the Physical Switch
Some external drives such as USB flash drives, SD cards, and so on include a physical write-protection button. The storage device’s writable options will be disabled, blocking DiskPart from changing the disk attribute to writable, if this switch is activated.
If you are unable to clear disk attributes read-only on external drives using DiskPart, check for a physical write-protection switch. If there is one, turn it off. Then, after restarting the Windows Explorer process, run the attributes disk clear read-only command again to see whether the problem has been fixed.
Modify WriteProtected Key in Registry Editor
If there is no physical switch on your external drive, the problem might be caused by a registry key.
To fix this issue, you can try modifying the WriteProtected key in Registry Editor. Here’s how:
Press Windows + R keys on your keyboard to open the Run dialog box.
Type Regedit and click OK to open Registry Editor.
In the left pane of Registry Editor, navigate to the following location: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies
Now, in the right pane of the StorageDevicePolicies key, look for an entry named WriteProtect. If it exists, double-click on it to modify its value.
Set its Value data to 0 and click OK to save changes.
Close Registry Editor and restart your computer.
Decrypt the Disk
If the disk is encrypted with BitLocker, you will get the DiskPart Access denied error. This is because BitLocker is a security feature that encrypts your data.
To fix this, you need to decrypt the drive first. You can do this by opening the BitLocker Control Panel and clicking on “Turn off BitLocker”.
Close All Open Programs
Another common reason for the “DiskPart has encountered an error: Access is denied” error is that the disk is in use by another process. This can happen if you have any programs open that are using files on the disk.
To fix this, you need to close all open programs, especially the File Explorer, and try again.
Use a Third-Party Tool
If you are still having problems with the DiskPart Access denied error, you can try using a third-party tool such as the AOMEI Partition Assistant application.
AOMEI Partition Assistant Standard is a free disk partition manager that can be used to format disks, create partitions, resize partitions, and more.
If you are getting the “DiskPart has encountered an error: Access is denied” error, then you can try one of the methods mentioned above to fix it. We hope that this article was helpful and that you were able to fix the issue. Thank you for reading.
You can try one of the methods mentioned in this article to fix the “DiskPart has encountered an error: Access is denied” error.
The DiskPart Access denied error can be caused by a number of factors, including incorrect permissions, corrupt files, or a corrupt disk.
Peter is an Electrical Engineer whose primary interest is tinkering with his computer. He is passionate about Windows 10 Platform and enjoys writing tips and tutorials about it.