Home » How To » How to Remove Partition with PowerShell Command

How to Remove Partition with PowerShell Command

You can remove any partition in Windows 10 with a single PowerShell command. Here’s the exact command and how to execute it.

On Windows 10, you can divide the hard disk or an SSD into any number of partitions. Each partition will appear as a separate drive in the File Explorer. Each drive has its own drive letter to make it easy to recognize and remember. These drives help you better categorize and manage your files and folders. For example, you can create separate partitions for all your games, media, and personal files.

Just as you can create partitions, you can also remove partitions. This is helpful when you no longer need a partition or to expand another partition. For example, recently I installed quite a few games on my game drive it got full really quickly. So, I deleted an extra partition that I’m not using that much and expanded the game drive.

Though there are several different ways to remove a partition in Windows 10. In this quick guide, however, I will show how to remove a partition with the PowerShell command-line tool. This is helpful if you want to dip your hand in the command-line or to create your own scripts.

Important note: Before removing a partition, make sure there are not file in it. If there are any, back them up. Once you delete the partition, you might be able to recover them.

Remove partition with PowerShell

1. Open the PowerShell application as an admin. To do that, right-click on the Start menu and select the “Windows PowerShell (Admin)” option.

Open-powershell-as-admin-050121

2. Get a list of partitions with the “Get-Volume” cmdlet. This command will show a table in the PowerShell window with all the available partitions.

Get-partitions-list-powershell-050121
get drive list in powershell

3. To remove a partition, execute the below command. Replace the “X” with the actual drive letter of the partition you want to delete. For example, to delete partition “E” replace “X” with that drive letter.

Remove-Partition -DriveLetter X

Remove-partition-powershell-command-050121
remove partition in powershell

4. Type “Y” in the PowerShell window and press Enter. This action will confirm that you really want to remove the target partition.

Delete-partition-powershell-command-050121

As soon as you confirm the action, Windows PowerShell will remove the partition and mark it as unallocated.

Since the deleted space is marked as unallocated, you can use it to create a new partition or expand an existing partition. If you want to expand, the partition, I recommend you first back up all the files in the partition you want to expand. Moreover, use a partition manager GUI tool, like the built-in Disk Management tool. This is especially important if you’ve never done this via command line.

That is all I hope that helps. If you are stuck or need some help, comment below and I will try to help as much as possible.

Here are some more articles regarding Windows partitions and drives. Check them out while you are here.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top