Skip to content

Instantly share code, notes, and snippets.

@lantrix
Forked from nsabine/create_spanned_drive.ps1
Last active August 29, 2015 14:08
Show Gist options
  • Save lantrix/d868e56b4cbce7349ea8 to your computer and use it in GitHub Desktop.
Save lantrix/d868e56b4cbce7349ea8 to your computer and use it in GitHub Desktop.
$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 `
}
#2..
$a = "create volume stripe disk=1" #Fix Hardcoded disk 1...
$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