# Create-VHD # Command line tool for batch creation of virtual disks ### # Parameters : # # count: Number of virtual disks to create. # Default: 10 # # size: Size of the virtual disks to create, in MB. # Default: 10000 (10GB). param( [int]$count = 10, [int]$size = 10000 ) $tmpfile = "diskpart.tmp" Remove-Item $tmpfile for($i = 0; $i -lt $count; $i++) { $filename = "$(Convert-Path .)\$i.vhdx" Add-Content $tmpfile "create vdisk file=$filename maximum=$size type=expandable" Add-Content $tmpfile "select vdisk file=$filename" Add-Content $tmpfile "attach vdisk" } diskpart /s $tmpfile Remove-Item $tmpfile