Created
August 7, 2013 19:09
-
-
Save nsabine/6177413 to your computer and use it in GitHub Desktop.
Create a spanned volume in windows from AWS ephemeral disks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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