0

I'm trying to create a partition on the USB flash drive using the New-Partition cmdlet. But when I use the -AssignDriveLetter option I get "New-Partition : Invalid Parameter" even though this option exists in the documentation:

PS C:\WINDOWS\system32> $disk = (Get-Partition -DriveLetter "F" | Get-Disk)    
PS C:\WINDOWS\system32> $disk

Number Friendly Name                            OperationalStatus                          Total Size Partition Style          
------ -------------                            -----------------                          ---------- ---------------          
4      UFD 2.0 Silicon-Power16G USB Device      Online                                       15.14 GB MBR                      

PS C:\WINDOWS\system32> $disk | Clear-Disk -RemoveData

PS C:\WINDOWS\system32> New-Partition -DiskNumber $disk.Number -Size 350MB -AssignDriveLetter -IsActive
New-Partition : Invalid Parameter
At line:1 char:1
+ New-Partition -DiskNumber $disk.Number -Size 350MB -AssignDriveLetter -IsActive
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (StorageWMI:ROOT/Microsoft/Windows/Storage/MSFT_Disk) [New-Partition], CimException
    + FullyQualifiedErrorId : StorageWMI 5,New-Partition

Strangely, the partition is still created and some drive letter is assigned to it.

Why am I getting this error?

6
  • Are all of you questions related to issues with the same USB flash drive?
    – jscott
    Mar 31, 2013 at 1:20
  • Yes. But they are different questions, so I split them.
    – Ark-kun
    Mar 31, 2013 at 1:25
  • what is in your $disk variable?
    – August
    Apr 1, 2013 at 12:52
  • @August I've already closed the console. What are you interested in? It's just a normal (flash) drive without partitions (after Clear-Disk).
    – Ark-kun
    Apr 1, 2013 at 18:11
  • 1
    How did you populate $disk? What data is in that variable? It seems to be an object based on the way you are using it ($disk.Number), but you don't say how you populated it in the first place or what data it contains. You can't just type "$disk" and get info out of it.
    – August
    Apr 1, 2013 at 18:16

0

You must log in to answer this question.

Browse other questions tagged .