Delete Protected Partitions with Command Prompt

Delete Protected Partitions With Command Prompt (Windows PowerShell, Terminal)

Within any version of Windows, it is possible to delete partitions on drives without the use of any additional third-party software.

If you wish to completely restore a hard disk back to factory settings without any partitions, we can use either Command Prompt, Windows PowerShell (in Windows 10) or Windows Terminal (in Windows 11).

Remove Hidden & Protected Disk Partitions

Often if you are recycling drives that have been pulled from systems, they will have multiple partitions on them that were used for things like Windows recovery in laptops. By simply formatting the drive, this will only format the main (largest) partition. But this leaves multiple protected partitions on the disk.

The following method will remove all visible, hidden, protected and shadow copy partitions that the Disk Management tool in Windows is unable to delete.

Open Powershell (Admin)

To open Powershell with administrative rights, simply right-click on your Start Menu flag icon and open PowerShell (Admin). If you are using Windows 11, this may be worded Windows Terminal (Admin).

The series of commands that we are going to use are called DISKPART.

Instructions To Delete Partitions Using DISKPART In PowerShell

  1. At the main command prompt type & enter diskpart

  2. At DISKPART prompt, type & enter list disk

  3. From DISKPART prompt type & enter select disk 6 (or whatever disk you wish to delete)

  4. Once selected type & enter list partition

  5. Type & enter select partition 1

  6. Type & enter delete partition

  7. Repeat until all partitions are gone.

Instructions in Command Prompt to delete partitions in PowerShell usinf DISKPART

How To Override Protection When Deleting Disk Partitions

Use “override” command if you receive the following message:

Virtual Disk Service error:
Cannot delete a protected partition without the force protected parameter set.

To override this issue, you simply go ahead and type:

delete override

(The disk and partition are already selected when you get this message so type it in straight after receiving the alert).

This will force the deletion of the partition. You may have to repeat this for other protected partitions until the drive is clear.

Virtual Disk Service error:
Cannot delete a protected partition without the force protected parameter set.

Once finished, type and enter exit

Video To Accompany This Article