Hello everyone! :)
I've been trying to format a 32GB flash drive. I'm using DiskPart to format it, but still have no success. I've been trying and trying, but I always encounter the same error. "DiskPart has encountered an error: Access is denied. See the System Event Log for more information". I tried different commands to format it, but I still arrive at the same error. I am the admin, so I don't think that's the problem.
SELECT DISK 1
CREATE PARTITION PRIMARY
SELECT PARTITION 1
FORMAT FS=NTFS QUICK
(I did try FAT and FAT32, none of those worked)
Help me, please!
Thank you and have a nice day! :)
If you are attempting to clean your disks like a USB flash drive or an SD card via diskpart, you are going to confront the error saying diskpart has encountered an error: Access is denied. It fails to access the drive. This means either there is any connection issue due to which the drive is not accessed or there exists any blockage of drive that is hindering the process of format via diskpart.
Diskpart being a utility to manage your disk/drive either external or internal comes in a user-friendly GUI along with all its disk management tools. If the in-built GUI disk management on windows 10 fails to work properly, diskpart is there to work. But this does not mean that it is immune to error. While using diskpart you may confront a potential error: Access is denied (Its error code is 5@020A0019). This will not allow you to access the targeted disk and would block all the functionality of the utility. In the system event log, you may see: Failed to open device \\?\GLOBALROOT\Device\HarddiskVolume5. It represents the drive as unauthorized or write-protected.
This article will explain the potential reasons causing the error, some quick-fix methods to resolve the error, and methods to recover the data from the inaccessible hard drive. The guide bar is on the right!
Before digging in deep to find out the quick fix techniques to resolve the error i.e. diskpart has encountered an error: access is denied, at first, let’s find out the potential underlying causing working in the background to show up this error while using diskpart. Here are some of them:
While using diskpart to format the disk/drive, you can use the CMD command prompt. In case, if your command prompt does not have administrative privileges, you are not able to write any command to run for proceeding with the action. To get rid of this, try to operate the command prompt with admin access.
Sometimes, the disk/drive is write-protected, and accessing it without any authority to make changes on it may end up showing the error i.e. diskpart has encountered an error: Access is denied. If you want to make changes on the drive/disk with diskpart, first disable the security feature from diskpart, or else you can use the registry editor to disable the write protection.
These two culprits may disturb the normal functioning of diskpart and fails the utility to perform any action on the targeted disk/drive.
Once you are familiar with the actual reason behind diskpart has encountered an error: access is denied, now the next step is to find out some quick-fix techniques to resolve the error. Here in this section, you may find two built-in utility methods to fix diskpart has encountered an error: Access is denied. Let’s get started!
As mentioned above, due to the command prompt without administrative privileges, you may confront the error. The easiest way to fix the error is to run the command prompt with admin access. Here are the steps to follow:
Step 1: Press Windows key + R to launch the Run dialogue box. As the box launch, type cmd in it and press Ctrl + Shift + Enter to launch the elevated command prompt.
Step 2: In the next window of UAC (user account control), click yes to give the administrative access/privilege.
Step 3: Now in the elevated command prompt, open diskpart utility.
If administrative access was the issue causing the error, it would be resolved and you can easily run the commands.
In the above section of reason causing diskpart has encountered an error: access is denied, the second culprit was the write protections. So to resolve the error, disabling write protection may help. Here are the steps:
Step 1: In the main menu of windows, click on start, and in the drop-down select the option of the run.
Step 2: In the search box, type Regedit.
Step 3: Nextly, navigate across HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies.
Step 4: In the next window, double click write protect and change the numeral to 0.
Disabling the write-protection can be done via diskpart or registry editor. Here is how u=you can use both built-in utilities.
Disabling write protection via Diskpart
Using disport to remove the write-protections of targeted disk/drive to resolve error i.e. diskpart has encountered an error: access is denied, here are the steps:
Step 1: Press Windows key + R to launch the Run dialogue box. In the box type diskpart and click enter to continue. Open diskpart.
Step 2: In the next command prompt, type the following commands, and click enter.
1. Select Disk X
attribute disk clear readonly
Step 3: Once all the commands are typed, now restart your device to check if the error is resolved. Use diskpart to check the operation.
If you are opting the registry editor to disable the write protection of disk/drive then here are the steps to follow:
Step 1: Press Windows key + R to launch the run command box. In the box type Regedit and click enter to launch the registry editor.
Step 2: Allow administrative privileges via UAC (user account control). Locate for the path in registry editor i.e. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies.
Step 3: Make the value to 0.
In case, if you are unable to resolve the error diskpart has encountered an error: access is denied, then surely there are some other technical or physical issues with the drive. The best possible way is to recover all the data saved on the drive to avoid data loss. Or in case you have lost your data from the targeted drive, you can easily recover it via third-party recovery software. In this context, Wondershare Recoverit data recovery software is the best tool to be considered as your solution. The tool helps to recover the data from all corrupted/damaged partitions and bad sectors of the drive. You can recover everything i.e. images, videos, document files, audio files, etc. it is compatible with both internal and external hard drives. Wondering how it works? Here are the steps:
Step 1 Attach the targeted drive (corrupted drive) with your device, in case if you lot of data from the external hard drive. Make sure it is an inappropriate connection.
Step 2 Download and install Recoverit data recovery software on your device.
Step 3 Once installed, launch the software, and in the main menu, select the data recovery mode. If you have lost the data from the internal drive, then you can select the deleted files recovery and if you have lost data from the external drive, you can go for external devices recovery.
Step 4 In the next window, select the drive from where you lost the data, and cluck starts to initiate the scan.
Step 5 The software will scan all the lost files and retrieve them. In case, if it is not working, you can select the all-around recovery mode.
Step 6 All the retrieved files will be displayed on the screen. Preview them one by one and select the files you want to restore. Click recovery to complete the action.
Once the files are recovered, make sure you save them in different locations apart from the one from where you lost the files at first. Hence, diskpart is a useful utility that manages your disks/drive on the computer. It is compatible with both internal and external drives/disks. When Windows 10 built-in disk management fails to work properly, diskpart can work efficiently on its behalf. But it also faces a potential error i.e. diskpart has encountered an error: Access is denied. It occurs due to write-protection issues or commands prompt problems that are running without administrative access. Both of the reasons make the drive inaccessible for diskpart and presents it as blocked or unauthorized. This article explains quick-fix methods to resolve the error. You can fix the issue by running a command prompt with administrative privileges or disable the write-protection either by diskpart or registry editor. If you still fail to resolve the error, the use of Recoverit data recovery software to restore all the lost data from the corrupted/damaged drive.