If you have an external hard drive or a USB drive that you can not format from the File Explorer, you can review this guide. This will help you format the external hard drive or USB drive using Windows PowerShell. As you may already know that Windows PowerShell is an integrated tool, you do not need to install third-party software.
Windows users can easily format an internal hard disk, an external hard disk or SSD, a USB drive, and so on. with the help of the built-in option. This option is in This PC or My Computer. Sometimes this specific feature may be a mess because of the hard drive or corrupted file, and you may not be able to format the drive. At such a time, you have other options. For example, you can use the Disk Management pane, the command prompt, and so on. to do the work. Similarly, you can use Windows PowerShell to delete and create partitions, modify the file system, and so on. of your USB key or hard drive.
What can you do with Windows PowerShell?
You can change the following items from an external hard drive or from a USB-drive
- Format the hard drive
- Change the file system
- Create a partition
- Edit the drive letter
Format an external hard drive with the help of PowerShell
To format the external hard disk or USB drive using Windows PowerShell, follow these steps:
- Connect the USB or external hard drive to your computer
- Open Windows PowerShell with Administrator Privileges
- Recognize the drive you want to delete
- Enter the command.
First, you need to plug in your external hard drive or USB drive so your computer can do the work. After that, you must open Windows PowerShell with administrator privileges. To do this, press Win + X and select Windows PowerShell (Admin).
You must now identify the disk you want to format. To do this, enter the following command-
You should get a result like this
You should find the name of your external hard drive in the Familiar name column. You should also note the hard drive number.
To start the process, enter this command-
Clear-Disk -Number 2 -RemoveData
You must replace the number 2 with the original number assigned to your reader. In this example, we want to format the Sony Storage Media (check the screenshot above), which is numbered 2. This may be different if your external hard drive displays a different number.
You should now receive a confirmation message. Type Yes and press the Enter button.
It should take a few seconds to complete the process. Now you have to enter the following command-
New-Partition -DiskNumber 2 -UseMaximumSize -IsActive -DriveLetter Z
This will help you create a partition. In addition, there are two things you need to know about this command. First, the number 2 represents the drive you formatted previously. Second, the Z represents the drive letter that will be assigned to the external hard drive or USB drive.
After entering this command, a pop-up window will appear to format your drive. You can use this popup window option, or you can use the following command-
Format-Volume -DriveLetter Z -FileSystem FAT32 -NewFileSystemLabel USB
Here is one crucial thing you need to know. If you want to format the drive in the FAT32 file system, you must choose it in the command. However, if you are 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 may take a few seconds longer than FAT32.
After entering the last command you will be able to use the external hard drive or USB key regularly.
You can also format the USB key with the help of the command prompt.