How to format drive using PowerShell on Windows 10

Here are the steps to properly format a hard drive using PowerShell commands on Windows 10.

PowerShell format drive command
PowerShell format drive command

When setting up a new hard drive on Windows 10, you want to format it properly to delete any data and configure a compatible file system to allow Windows to read and write data. If you are getting rid of the drive, you also want to format it to wipe out any of your files to prevent someone else from getting a hold of them.

Although it might sound like a tedious process, it’s not, and Windows 10, similar to previous versions, includes many ways to quickly format a drive, including using PowerShell.

In this guide, you will learn the steps to use PowerShell commands to format a hard drive on Windows 10, whether it’s a new drive or you simply want to delete everything and start over.

Format drive using PowerShell on Windows 10

The process of formatting a drive and getting it ready to store data is straightforward. Just make sure to understand that going through these steps will erase everything stored in the drive. 

To format a hard drive using PowerShell commands on Windows 10, use these steps:

  1. Open Start.

  2. Search for PowerShell, right-click the result, and select the Run as administrator option.

  3. Type the following command to identify the drive to repair and press Enter:

    Get-Disk
  4. Type the following command to wipe out the drive on Windows 10 and press Enter:

    Get-Disk 1 | Clear-Disk -RemoveData

    In the above command, change 1 with the disk number of the drive you want to format (see Step 3). If you specify the number incorrectly, you could wipe out the wrong drive causing data loss.

  5. Type A to confirm that you want to wipe the specified drive and press Enter.

  6. Type the following command to initialize the disk with the default GUID Partition Table (GPT) partition scheme and press Enter:

    Initialize-Disk -Number 1

    In the above command, change 1 with the disk number of the drive you want to format (see Step 3).

    Important: Although it’s recommended to use a GPT partition scheme, if required, you can use the Master Boot Record (MBR) scheme using this command: Initialize-Disk -Number 1 -PartitionStyle MBR.
  7. Type the following command to format and create a new partition on the drive, and press Enter:

    New-Partition -DiskNumber 1 -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel myDrive

    In the above command, change 1 with the disk number of the drive you want to format on Windows 10 and change myDrive with the name to use for the storage.

  8. Type the following command to assign a drive letter to the disk drive and press Enter:

    Get-Partition -DiskNumber 1 | Set-Partition -NewDriveLetter G

    In the above command, change 1 with the disk number of the drive you want to format and G with the letter to assign to the storage. If you get the “Set-Partition: The requested access path is already in use” error message, run the command one more time or specify a different drive letter.

    PowerShell format command

Once you complete the steps, the newly formatted hard drive will appear in File Explorer.

About the author

Mauro Huculak is a Windows How-To Expert who started Pureinfotech in 2010 as an independent online publication. He has also been a Windows Central contributor for nearly a decade. Mauro has over 15 years of experience writing comprehensive guides and creating professional videos about Windows and software, including Android and Linux. Before becoming a technology writer, he was an IT administrator for seven years. In total, Mauro has over 21 years of combined experience in technology. Throughout his career, he achieved different professional certifications from Microsoft (MSCA), Cisco (CCNP), VMware (VCP), and CompTIA (A+ and Network+), and he has been recognized as a Microsoft MVP for many years. You can follow him on X (Twitter), YouTube, LinkedIn and About.me. Email him at [email protected].