Link to home
Start Free TrialLog in
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

Thanks,

Roger
ASKER CERTIFIED SOLUTION
Avatar of Rainer Jeschor
Rainer Jeschor
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Roger Alcindor
Roger Alcindor

ASKER

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 ?

Thanks,

Roger
Hi,
sorry I misread the drive letter. I tested the script on identical os
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
__SUPERCLASS     :
__DYNASTY        : __PARAMETERS
__RELPATH        :
__PROPERTY_COUNT : 1
__DERIVATION     : {}
__SERVER         :
__NAMESPACE      :
__PATH           :
ReturnValue      : 15
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.
Hi Roger,
hm, according to MSDN documentation, return code 15 means:
Cluster size is too small
http://msdn.microsoft.com/en-us/library/aa390432(v=vs.85).aspx

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:'"
$drive

Open in new window


Can you format it through Windows Explorer?

Thanks.
Rainer
OK, glad that it worked
In answer to your question, it is a DELL 320 GB removable hard disk RD1000.