We're developing a system that needs to manage virtual machines.
I work with vmm 2012 R2 testing the performance differences between attach\detach of virtual drives to VMs with and without using 'JobGroup'.
My scripts looks like the following:
with JobGroups:
$VirtualHardDisk = Get-SCVirtualHardDisk -VMMServer localhost | where {$_.Location -eq "\\ZNest20HV01.zertolab.local\MSSCVMMLibrary\VHDs\Blank Disk - Large.vhd"} | where {$_.HostName -eq "ZNest20HV01.zertolab.local"} New-SCVirtualDiskDrive -VMMServer localhost -SCSI -Bus 0 -LUN 0 -JobGroup d24e270e-3ec3-459a-86bf-33f230f3d507 -VirtualHardDisk $VirtualHardDisk -FileName "tmp2_Blank Disk - Large.vhd" -VolumeType None $VirtualHardDisk = Get-SCVirtualHardDisk -VMMServer localhost | where {$_.Location -eq "\\ZNest20HV01.zertolab.local\MSSCVMMLibrary\VHDs\Blank Disk - Small.vhdx"} | where {$_.HostName -eq "ZNest20HV01.zertolab.local"} New-SCVirtualDiskDrive -VMMServer localhost -SCSI -Bus 0 -LUN 1 -JobGroup d24e270e-3ec3-459a-86bf-33f230f3d507 -VirtualHardDisk $VirtualHardDisk -FileName "tmp2_Blank Disk - Small.vhdx" -VolumeType None
...62 more drives...
$VM = Get-SCVirtualMachine -VMMServer localhost -Name "tmp2" -ID "e20da734-4b20-4417-900c-336f9817d7a4" | where {$_.VMHost.Name -eq "02.lab.local"} Set-SCVirtualMachine -VM $VM -JobGroup d24e270e-3ec3-459a-86bf-33f230f3d507 -RunAsynchronously -StartAction NeverAutoTurnOnVM -StopAction SaveVM
Running this kind of script for 64 volumes takes 1 hour and 4 minutes.
When I re-write the script to run without JobGroup it looks like this:
$VM = Get-SCVirtualMachine -VMMServer localhost -Name "tmp2" -ID "e20da734-4b20-4417-900c-336f9817d7a4" | where {$_.VMHost.Name -eq "znest20hv02.zertolab.local"} $VirtualHardDisk = Get-SCVirtualHardDisk -VMMServer localhost | where {$_.Location -eq "\\ZNest20HV01.zertolab.local\MSSCVMMLibrary\VHDs\Blank Disk - Large.vhd"} | where {$_.HostName -eq "ZNest20HV01.zertolab.local"} New-SCVirtualDiskDrive -VM $VM -SCSI -Bus 0 -LUN 0 -VirtualHardDisk $VirtualHardDisk -FileName "tmp2_Blank Disk - 1.vhd" -VolumeType None $VirtualHardDisk = Get-SCVirtualHardDisk -VMMServer localhost | where {$_.Location -eq "\\ZNest20HV01.zertolab.local\MSSCVMMLibrary\VHDs\Blank Disk - Small.vhdx"} | where {$_.HostName -eq "ZNest20HV01.zertolab.local"} New-SCVirtualDiskDrive -VM $VM -SCSI -Bus 0 -LUN 1 -VirtualHardDisk $VirtualHardDisk -FileName "tmp2_Blank Disk - 2.vhdx" -VolumeType None ... 62 more drives... ...
Running the script on the same server (with 64 volumes as before) takes ~57 minutes.
I was under the impression that 'JobGroup' should improve the performance of my script but instead I see the opposite.
Any idea why?