How to Format Hard Drive Using PowerShell

October 9, 2017 updated by Admin Leave a reply »

Is there a simple PowerShell script to format a USB disk? If you have a brand new hard drive, or you want to erase all the data from a disk, you have to format it. In this tutorial we’ll explain how to format a hard drive using PowerShell commands in Windows 10.

How to Format Hard Drive Using PowerShell?

  1. To open Powershell as admin in Windows 10, press the Windows key + X together and then select “Windows PowerShell (Admin)“.

  2. Type the following command to find the hard drive you want to format.

    Get-Disk

  3. To clear all partitions and volumes from your disk, type the following command. Replace 1 with the disk number of the drive you want to format.

    Clear-Disk -Number 1 -RemoveData

  4. Next, create a new partition on your blank disk, and assign a drive letter:

    New-Partition -DiskNumber 1 -UseMaximumSize -IsActive -DriveLetter E

  5. To format the newly-created partition with the NTFS file system, type the following command and press Enter. Replace ‘USB’ with the volume label you want to use.

    Format-Volume -DriveLetter E -FileSystem FAT32 -NewFileSystemLabel USB

  6. Once you’ve completed the steps, you can now access the new partition in Windows Explorer.