On Windows 10, if you keep getting the “Please insert a disk into USB drive” message trying to access your USB flash drive, or the “Windows was unable to complete the format” message when trying to reformat the drive, chances are that the drive has corrupted data or something else went totally wrong.
In these types of scenarios, cleaning the drive completely and creating a new partition with the correct settings is likely to fix the problem, and on Windows 10, you can quickly fix this problem with your USB flash drive, SD card, or another removable drive using a few PowerShell commands.
In this guide, you’ll learn the steps to use PowerShell commands to repair any USB flash drive that is not accessible and as a result you can’t reformat on Windows 10.
How to repair a USB drive using PowerShell
To repair a USB drive with PowerShell commands, use these steps:
Open Start on Windows 10.
Search for PowerShell, right-click the result, and select the Run as administrator option.
Type the following command to identify the removable drive you want to repair and press Enter:
Type the following command to erase the drive completely and press Enter:
Get-Disk 1 | Clear-Disk -RemoveData
In the above command, make sure to change 1 with the disk number of the drive you want to repair. If you specify the number incorrectly, you could end up wiping out the wrong drive causing data loss.
Type Y to confirm that you want to wipe the specified drive and press Enter.
Type the following command to create a new partition using the NTFS file system and assign a name for the USB drive and press Enter:
New-Partition -DiskNumber 1 -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel myUSB
In the above command, make sure to change 1 with the disk number of the drive you want to repair, and change myUSB with the name you want to use for the storage.
Type the following command to assign a drive letter to the USB drive and press Enter:
Get-Partition -DiskNumber 1 | Set-Partition -NewDriveLetter F
In the above command, make sure to change 1 with the disk number of the drive you want to repair, and change F with the letter you want to assign to the storage.
Once you complete the steps, open File Explorer and navigate to “This PC,” and you should now be able to access and store data on the removable drive.
Update May 15, 2020: This guide was originally published in September 2017, and it’s been updated to make sure the information still accurate.