Rapid Provision 100 Virtual Machines using Data ONTAP SMI-S Agent 5.1 - SCVMM SAN-COPY based VMM Templates and PowerShell Cmdlets in less than 38 minutes.

I hope you all enjoyed my series of blog posts on how to leverage SCVMM - SMI-S integration to effectively manage your Hyper-V Storage environment. In this blog post i would demonstrate how you can use a powershell script / function which leverages SCVMM powershell cmdlets to rapidly provision Virtual Machines using SCVMM SAN-COPY based VMM templates.


Prerequisites for this PowerShell script require that you set up SCVMM SAN-COPY based VMM templates.


For more details on how to set it up,  refer to "Data ONTAP SMI-S Agent 5.1 - Use NetApp SMI-S Provider for SAN-Copy based VM Rapid provisioning using SCVMM 2012 R2".


In the below figure, you can see the vhdx file used by the VMM template, which shows that the "SAN Copy capable" property is set to true.



The below figure shows the VMM template, which contains the above vhdx file.



Next, let me show you the powershell script which works out this magic


# Extract the VMM Template details which contains vhdx file which is SAN Copy Capable

$VMTemplate = Get-SCVMTemplate | ?{$_.name -match "VM-SAN-COPY-Template"}


# Extract the Hyper-V Host details which would be used to place the VM's

$VMHost = Get-SCVMHost -ComputerName "ms-w2k12-1.virtualcloud.com"


# Below we rapid provision 100 VM's with similar Virtual Machine Configuration, once the VM's get provisioned they would also get powered on.

1..100 | %  {



$virtualMachineConfiguration = New-SCVMConfiguration -VMTemplate $VMtemplate -Name "VM-SANCOPY-$_"

Write-Output $virtualMachineConfiguration

Set-SCVMConfiguration -VMConfiguration $virtualMachineConfiguration -VMHost $vmHost

Update-SCVMConfiguration -VMConfiguration $virtualMachineConfiguration

Set-SCVMConfiguration -VMConfiguration $virtualMachineConfiguration -VMLocation "E:\" -PinVMLocation $true

Update-SCVMConfiguration -VMConfiguration $virtualMachineConfiguration

New-SCVirtualMachine -Name "VM-SANCOPY-$_" -VMConfiguration $virtualMachineConfiguration

Start-SCVirtualMachine -VM "VM-SANCOPY-$_"




My current setup consists of a 35GB vhdx file. As you can see in the below figure, the time taken to provision a single VM is about 16 seconds.



Once we get the 100 VM's provisioned and Powered on, lets check the time it took to provision these 100 VM's



As you can see below, I have wrapped a Measure-Command cmdlet around my script to measure the time take to provision 100 VM's. It can be seen that it took only 38 minutes and 31 seconds to complete.



Guys, so think of the possibilities, if i created these 100 VM's using BITS copy of the vhdx files, it would take about 1 hour per VM .


This technology can be leveraged for a large scale VDI deployment. You can also invoke a set of powershell scripts which carry out configuration activities when the VM boots up, for example to configure IP addresses from a SCVMM IP Address Pool.


I hope that you have enjoyed this blog entry and have found this information helpful.


Good Luck!