Powershell – quick format drive based on drive letter name

Here is a cool Powershell command that will find a removable drive, quick format the drive, then name the drive.

This command is special because it searches for the drive name versus the drive letter. Sometimes drive letters change; this command will ensure that you are always deleting the correct drives data.

Powershell Command:

Get-Volume | Where-Object { ($_.FileSystemLabel-like “Test*”)-and($_.DriveType-eq “Removable”) } | ForEach-Object { Format-Volume -DriveLetter $_.DriveLetter -NewFileSystemLabel “Test2” -confirm:$false }

Test* will find any removable drive that starts with Test
Example: Test, Test1, Test54, TestABC, etc
-You can search for any naming convention you already have.

The current command will name the formatted drive Test2.
-You can change it to whatever you’d like.

Try it out!

Let me know what creative uses you use it for!

Leave A Reply

Your email address will not be published. Required fields are marked *