customer relationships

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!


Got a project that needs expert IT support?

From Linux and Microsoft Server to VMware, networking, and more, our team at CR Tech is here to help.

Get personalized support today and ensure your systems are running at peak performance or make sure that your project turns out to be a successful one!

CONTACT US NOW
one click social media designs