How to format a USB or hard drive with PowerShell

If our intention is to format an external hard drive, USB or SSD, we can do it in several ways, which incorporates Windows 10. But it may also be the case that we have a damaged external storage drive, and that our computer does not read it correctly and we cannot format it.

In that case, we have a solution that is to format this drive with the Windows PowerShell . Which incorporates all the necessary tools for this, without having to download anything.

Although what we want is to format our unit, we have several options such as the system storage manager, the menu we have when we right click> format, among others.

If you are wondering what are the possibilities of PowerShell, we can tell you that we can do the same as with the Windows storage manager. But with this method we can do it in a faster and easier way if we follow the steps.

format-with-powershell

PowerShell: how to format a hard drive, SSD or USB

Among the things we can do is:

  • Format the disk or flash drive.
  • Modify the file system you use (NTFS, FAT32 among others)
  • Create partitions on the disk.
  • Rename the disk or partitions.

Steps to follow

The main thing is to have inserted the hard disk, the external SSD or flash drive that we want to format or change its properties. Once this is done, we will open the Windows PowerShell, we can do it in two ways:

  1. Windows + X> Windows PowerShell (Administrator)
  2. Home> PowerShell> Run as administrator

First of all, we recommend that when choosing the storage unit that we have, you make sure that it is the correct one and not format a unit which is being used for different reasons.

Once we have it open we must execute the following commands:

Get-disk

It will show us the disks that we have available in our equipment, we will make sure which one we want to format, and with what number it is identified to format it later.

In this case we will select disk 1 , which will be formatted.

Ver discos

Once this step is done we can proceed to format our disk with the following command:

The value “” must be modified.

Clear-Disk -Number “1” -RemoveData

Once the previous command has been executed, a message like this will appear, where we will have to indicate “S” (If we want to format the unit)

Borrado de la unidad

We would already have the formatted drive, now we will format it with the following command:

New-Partition -DiskNumber “1” -UseMaximumSize -IsActive -DriveLetter “K”

The letter “K” indicates that said partition will be located with that letter (Example: C: /)

Once this command has been launched, a new window will appear and we can use it or we can also do it using the following command:

Format-Volume -DriveLetter “K” -FileSystem NTFS -NewFileSystemLabel “USB”

Something that we should know, which is important, is that the value “NTFS” can be modified by the one that suits us, for example “FAT32”. Each user will choose the one that suits him, although for heavy files, more than 4 GB we recommend the NTFS format.

After having done all these steps we should already be able to use our storage unit correctly. If a command does not work for you, check it and have modified all the values to your own.