How to format a drive using PowerShell in Windows system


Microsoft’s Windows operating system comes with a very powerful internal tool named PowerShell. It is basically an advanced version of Command Prompt and can be used to customize the Windows system through commands.

Although there are many advanced use cases for the PowerShell tool in Windows, it can also be used to perform some less important tasks, such as formatting a drive, which can also be done through the PowerShell tool. disk management and a few other ways.

In this step-by-step guide, we will show you how to format the drive on your Windows computer using PowerShell commands.

How to Format Drive Using PowerShell in Windows 11

Step 1: Open the start menu and search for “PowerShell” and in the search results, right-click on the application and select the “Open as administrator” option.

2nd step: When the PowerShell opens, type the following command to identify the drive to repair:


Step 3: To erase your computer’s disk, type the following command:

Get-Disk 1 | Clear-Disk -RemoveData

Be sure to change the number “1” in the above command to the actual number of the drive on your computer that you want to erase. Specifying an incorrect number will erase data from the wrong drive, resulting in data loss.

Step 4: After that, enter the following command to initialize the disk with the default GUID Partition Table (GPT):

Initialize-Disk -Number 1

Also in this command change the number “1” with the drive you want to format.

Step 5: To format and create a new partition on the disk, use the following command:

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

As mentioned earlier, replace the number “1” with the actual drive number and replace “myDrive” with whatever name you want to use.

Step 6: To assign a drive letter to the disk, you need to enter the following command:

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

In the command, replace the number “1” with the actual drive number and replace “G” with the letter you want to assign to the drive.

That’s it. By following the steps mentioned above, you will format the drive and create a new partition, all using the PowerShell tool on your Windows computer.


Comments are closed.