-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvmgen.ps1
More file actions
33 lines (22 loc) · 738 Bytes
/
vmgen.ps1
File metadata and controls
33 lines (22 loc) · 738 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
param(
[int] $diskNumber = 1
)
$template = Get-Content -Raw -Path .\templates\vmmultidisk.json | convertfrom-json
$disks = $template.resources[0].properties.storageProfile.dataDisks
$disk = $disks[0]
$disksC = {}.Invoke()
for( $i=1;$i -le $diskNumber; $i++ )
{
$newDisk = "disk" + $i
$newContainer = "vhds" + $i
$newDisk, $newContainer
$disk
$diskR = $disk
$diskR.name = $disk.name.Replace( "disk1", $newDisk )
$diskR.name
$diskR.vhd.uri = $disk.vhd.uri.Replace( "vhds1", $newContainer ).Replace( "disk1", $newDisk )
$diskR.vhd.uri
$disksC.Add( $diskR );
}
$template.resources[0].properties.storageProfile.dataDisks = $disksC
convertto-json -depth 100 $template | Out-File .\vmmultidisk.json