Administrator Guide
#create VHDs
for($i=0;$i -lt $no_of_Vhds;$i++)
{
$diskNum = $i + $startNumber ;
$path = $location[$i%3];
$vhdpath = "$path$DPMName-Backup$diskNum.vhdx"
$vhdsize = 1024GB
New-VHD -Path $vhdpath -Dynamic -SizeBytes $vhdsize
$BackupDiskVHDPaths += $vhdpath
}
$VhdsToBeAdded2VM = $BackupDiskVHDPaths
#VHDsOnBus contains the existing VHDs count for bus(index of array)
$VHDsOnBus = @{}
for($Bus = 0; $Bus -lt $AdaptersCount; $Bus++)
{
$VDDs = $DPMVM.hardDrives | where{$_.ControllerNumber -eq $Bus -and $_.ControllerType -eq
"SCSI"}
if($VDDs -ne $null)
{
$VHDsOnBus[$Bus] = $VDDs.Count
}
else
{
$VHDsOnBus[$Bus] = 0
}
}
#Add VHDs to VM
foreach($VhdTobeAdded in $VhdsToBeAdded2VM)
{
#Find the bus with minimumm number of VHDs attached
$Bus = ($VHDsOnBus.GetEnumerator() | Sort-Object -Property value)[0].key
90
Operations