Script creating an extra volume RRS feed

  • Question

  • Hi All.

    I have put together this script, it does what i want it to do however its creating an extra empty volume with no label.

    $mounts = @("PHOTO","VIDEO","OTHER_MEDIA","FILES","DOCS")
    foreach ($mountpoints in $mounts)
        $noofdrives = 1
        $root_drive = "E:"
        $partition = 1
        For ($i=1; $i -le $noofdrives ; $i++) 
          $partition = $mounts.IndexOf($mountpoints) 
                   $datadirtype = $root_drive + "\$mountpoints"+ $i.ToString('00')
                   New-Item $datadirtype –ItemType Directory
                   New-Partition –DiskNumber $i -Size 10GB
                   Add-PartitionAccessPath -DiskNumber $i -PartitionNumber 2 –AccessPath $datadirtype
                   Get-Partition –Disknumber $i –PartitionNumber $partition | Format-Volume –FileSystem NTFS –NewFileSystemLabel $datadirtype -AllocationUnitSize 65536 –Confirm:$false
           #        Set-Partition -DiskNumber 1 -PartitionNumber $partition -NoDefaultDriveLetter $true

    Thanks in advance.

    Wednesday, March 20, 2019 2:55 PM

All replies

  • Hi,

    Thanks for your question.

    It works fine for me. I don't found it create extra volume.

    Best regards,


    Just do it.

    Thursday, March 21, 2019 3:11 AM
  • I kept having a blank one one with no label. Windows 2016
    Thursday, March 21, 2019 10:55 AM