Fix: DiskPart has Encountered an Error ‘Access is Denied’

Several Windows users are reporting receiving the “DiskPart has encountered an error: access is denied” error when trying to perform a DiskPart operation like resizing a partition or trying to format a drive. The issue is reported to occur on multiple Windows versions, so the problem is not tied to the operating system.

DiskPart has encountered an error: Access is denied.

What is causing the ‘DiskPart has encountered an error: Access is denied’ error?

We looked into the issue closely by analyzing various user reports and the repair strategies that most affected users have successfully deployed in order to get the issue resolved.  As it turns out, there are several different potential culprits that might end up triggering this particular error message:

  • Command Prompt doesn’t have administrative privileges – The most common reason why this issue occurs is that the Command Prompt is missing administrative privileges. In most case, the fix is to simply open the Command Prompt with admin access.
  • Write protection is enabled for the drive – Another popular culprit that will trigger this particular error when the drive is handled by DiskPart is write protection. If this scenario is applicable, you can get around it by disabling the security feature from DiskPart directly or via Registry Editor.

If you’re currently looking for potentials solutions that will allow you to bypass the ‘DiskPart has encountered an error: Access is denied’ error,  this article will provide you with several troubleshooting guides. Down below, you’ll find several different methods that other users in a similar situation have confirmed to be effective in resolving this issue.

For the best results, we advise you to follow the methods below in the order that they are presented. One of them is bound to fix the problem in your particular scenario.

Method 1: Running the Command Prompt with administrative privileges

The number one reason why this issue is occurring is that users forget that DiskPart requires administrative privileges in order to perform certain commands.  In other words, you’ll need to ensure that you open an elevated Command Prompt that you use with DiskPart as admin in order to bypass the  ‘DiskPart has encountered an error: Access is denied’ error.

Here’s the quickest way to do this:

  1. Press Windows key + R to open up a Run dialog box. Then, type “cmd” and press Ctrl + Shift + Enter to open up an elevated Command Prompt.
    Running CMD using the Run Dialog Box
  2. When prompted by the UAC (User Account Control) choose Yes to grant administrative privileges.
  3. In the Elevated Command Prompt that you’ve just opened, run the DiskPart utility again and see if you’re still experiencing the same behavior.

If you’re still seeing the ‘DiskPart has encountered an error: Access is denied’ error, move down to the next method below.

Method 2: Removing the Write Protection from the drive 

Another method that might just allow you to complete the DiskPart operation without seeing the ‘DiskPart has encountered an error: Access is denied’ error is to use remove the Write Protection. You can either do this directly via the DiskPart utility or by using the Registry Editor.

Follow whichever guide is more convenable to your current situation to remove write protection and resolve the issue:

Disabling write protection via Diskpart

  1. Press Windows key + R to open up a Run dialog box. Then, type “diskpart’ and press enter to open up the DiskPart utility.
    Run dialog: diskpart
    Run dialog: diskpart
  2. Type the following command and press Enter to get a list of all available disks:
    list disk
  3. Type the following command and press Enter to select a specific drive:
    Select Disk X
    Note: X is only a placeholder. Replace it with the number of the disk that you want to select.
  4. Once the disk is selected, type the following command to disable write protection for it:
    attribute disk clear readonly
  5. Restart your computer and see if the issue has been resolved and you can complete the DiskPart operation without seeing the  ‘DiskPart has encountered an error: Access is denied’ error.

Disabling write protection via Registry Editor

  1. Press Windows key + R  to open up a Run dialog box. Then, type “regedit” and press Enter to open up Registry Editor. When prompted by the UAC (User Account Control), click Yes to grand administrative privileges.
    Running the Registry Editor
  2. Inside Registry Editor, use the left-hand pane to navigate to the following path:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies

    Note: You can either navigate there manually or paste the address directly into the navigation bar.

  3. Move over to the right-hand pane, double-click on WriteProtect and change the value to 0 in order to disable write policy.
    Setting the WriteProject value to 0

If you’re still encountering the ‘DiskPart has encountered an error: Access is denied’ error, move down to the next method below.

Method 3: Using a 3-rd party tool to resize the partition (if applicable)

There are a few really good free 3-rd party tools that will allow you to resize partitions without using DiskPart. Several affected users have reported that going this route allowed them to complete the operation without encountering the ‘DiskPart has encountered an error: Access is denied’ error.

After tested different freeware tools capable of getting the job done, we have settled on Partition Manager Free as the best tool for our particular needs. Here’s a quick guide on installing and using Partition Manager Free to resize a partition:

Note: Partition editing has the potential of causing loss of data. Before you decide to go through with this, we advise you to back up your drive.

  1. Visit this link (here) and click the Download button to download the latest version of Partition Manager Free.
    Downloading Partition Manager Free
  2. Once the download is complete, open the installation executable and follow the on-screen prompts to Paragon Hard Disk Manager (the utility that holds Partition Manager Free).
  3. When the utility has been installed, open the Paragon Hard Disk Manager utility and create an account to log-in with your credentials to complete the online activation. Once the activation is complete, go to Tools and click on Partition Manager.
    Accessing the Partition Manager utility
  4. Next, use this utility the complete the same process that was previously failing inside DiskPart (merging, formatting, splitting, etc
ABOUT THE AUTHOR

Kevin Arrows


Kevin Arrows is a highly experienced and knowledgeable technology specialist with over a decade of industry experience. He holds a Microsoft Certified Technology Specialist (MCTS) certification and has a deep passion for staying up-to-date on the latest tech developments. Kevin has written extensively on a wide range of tech-related topics, showcasing his expertise and knowledge in areas such as software development, cybersecurity, and cloud computing. His contributions to the tech field have been widely recognized and respected by his peers, and he is highly regarded for his ability to explain complex technical concepts in a clear and concise manner.