Skip to content

Instantly share code, notes, and snippets.

@nsabine
Created August 7, 2013 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nsabine/6177413 to your computer and use it in GitHub Desktop.
Save nsabine/6177413 to your computer and use it in GitHub Desktop.
Create a spanned volume in windows from AWS ephemeral disks.
$disks = (wmic diskdrive list brief | measure-object -line | select -ExpandProperty Lines)-2
1..$disks | ForEach-Object -Begin {$a = $null} -Process { $a += $("select disk "+$_+[char][int](13)+[char][int](10)) ; $a += "online disk noerr "+[char][int](13)+[char][int](10) ; $a += "clean "+[char][int](13)+[char][int](10) ; $a += "attributes disk clear readonly noerr "+[char][int](13)+[char][int](10) ; $a += "convert dynamic noerr "+[char][int](13)+[char][int](10) ;} -End { $a += "exit"+[char][int](13)+[char][int](10) ; $a | Set-Content c:\diskpart1.txt -Encoding ASCII }
$a = "create volume stripe disk=1"
2..$disks | ForEach-Object -Process {$a += ","+$_}
$a += [char][int](13)+[char][int](10)
$a += "format fs=ntfs label=scratch quick"+[char][int](13)+[char][int](10)
$a += "assign letter=z"+[char][int](13)+[char][int](10)
$a += "exit"+[char][int](13)+[char][int](10)
$a | Set-Content c:\diskpart2.txt -Encoding ASCII
Diskpart /s c:\diskpart1.txt
Diskpart /s c:\diskpart2.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment