If you have an external hard drive or USB drive that you cannot format from File Explorer, you can check out this guide. It will help you to format the external hard drive or USB drive using Windows PowerShell.
Windows users can easily format an internal hard drive, external HDD or SSD, USB drive, etc., with the help of the in-built option. This option can be found in This PC. Sometimes, this specific functionality can be a mess because of the corrupted hard drive or file, and you may be unable to format the drive. At such a moment, you have some other options. For example, you can use the Disk Management panel, Command Prompt, etc., to complete the job. Likewise, you can use Windows PowerShell to delete and create partitions, change the File system, etc., of your USB drive or hard drive.
Disk Management features in PowerShell?
You can change the following in an external hard drive or USB drive using PowerShell:
- Format the hard drive
- Change File system
- Create partition
- Change drive letter
Format External Hard Drive using PowerShell
To format the external hard drive or USB drive using Windows PowerShell, follow these steps-
- Plugin the USB or external hard drive to your computer
- Open Windows PowerShell with admin privilege
- Recognize the drive that you want to delete
- Enter the command.
First, you need to plug in your external hard drive or pen drive so that your computer can do the job. After that, you need to open the Windows PowerShell with administrator privilege. For that, press Win+X, and select Windows PowerShell (Admin).
Now you need to identify the disk that you want to format. For that, enter the following command-
You should get a result like this-
You should find the name of your external hard drive in the Friendly Name column. Also, you need to note down the number of the hard disk.
To initiate the process, enter this command-
Clear-Disk -Number 2 -RemoveData
You need to replace the number 2 with the original number that is assigned to your drive. In this example, we want to format the Sony Storage Media (check the above screenshot), which is carrying the number 2. It might be different if your external hard drive is showing a different number.
Now you should get a confirmation message. Type Y and hit the Enter button.
It should take a couple of seconds to complete the process. Now, you need to enter the following command-
New-Partition -DiskNumber 2 -UseMaximumSize -IsActive -DriveLetter Z
It will help you create a partition. Also, there are two things you should know about this command. First, the number 2 represents the drive that you formatted earlier. Second, the Z represents the drive letter that will be assigned to the external hard drive or USB drive.
After entering that command, a popup will appear to format your disk. You can use that popup window option, or you can use the following command-
Format-Volume -DriveLetter Z -FileSystem FAT32 -NewFileSystemLabel USB
Here is one crucial thing that you should know. If you want to format the drive in the FAT32 file system, you need to choose that in the command. However, if you’re going to use the NTFS file system, the same command should look like this-
Format-Volume -DriveLetter Z -FileSystem NTFS -NewFileSystemLabel USB
If you choose NTFS, it might take a couple of more seconds than FAT32.
After entering the last command, you will be able to use the external hard drive or USB drive regularly.
TIP: You can format USB Drive using Command Prompt as well.