Avatar of Roger Alcindor
Roger Alcindor asked on

Windows Powershell format a USB disk

Can Anyone suggest a simple script to format a USB disk (quick format) where the disk is has a drive mapping of G:
This is to run on Microsoft Windows server 2008 R2



Avatar of undefined
Last Comment
Roger Alcindor

8/22/2022 - Mon
Rainer Jeschor

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Roger Alcindor

I forgot to mention that the windows server is running Windows Server 2008 R2 64 bit  O/S.
Does this affect your suggested script ? Also I assume that I should I use -Filter "DriveLetter = 'G:' " and not 'O' as in your code suggestion ?


Rainer Jeschor

sorry I misread the drive letter. I tested the script on identical os
Roger Alcindor

I have tried the script but it doesn't seem to work. No error is indicated but Windows PowerShell returns the following:

__GENUS          : 2
__CLASS          : __PARAMETERS
__RELPATH        :
__DERIVATION     : {}
__SERVER         :
__NAMESPACE      :
__PATH           :
ReturnValue      : 15
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Roger Alcindor

I have found out that 15 means cluster size too small. I tried 8192 and this worked OK, just returning a value of zero.

Thanks for your help - problem solved and points are yours.
Rainer Jeschor

Hi Roger,
hm, according to MSDN documentation, return code 15 means:
Cluster size is too small

What kind of USB stick is it? What size?
What is the current format (eg using the following PS command or Windows Explorer drive properties)?
$drive = Get-WmiObject -Class win32_volume -Filter "DriveLetter = 'L:'"

Open in new window

Can you format it through Windows Explorer?

Rainer Jeschor

OK, glad that it worked
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Roger Alcindor

In answer to your question, it is a DELL 320 GB removable hard disk RD1000.