Creating a lot of VMs - Shared/Community Script


I saw an intersting script in the following link: PowerShell Script to Create Lots of Windows Server 2012 Hyper-V Virtual Machines at Once - http://www.aidanfinn.com/2012/03/powershell-script-to-create-lots-of-windows-server-8-hyper-v-virtual-machines-at-once/ (by the way, cool script)

So, my need was a little different, so iv customized a little bit, and there is!



## Based on "PowerShell Script to Create Lots of Windows Server 2012 Hyper-V Virtual Machines at Once"
$parentpath = "C:\ClusterStorage\Volume1"
$baseVHDX = "\BASE.VHDX"
$vSwitchName = "EXTERNAL"
$VMName = "VM_"


foreach ($i in 1..200)
   {
$VHDXfilename = "$parentpath\$VMName$i.VHDX"
    New-VHD -ParentPath "$parentpath$baseVHDX" -Differencing -Path "$VHDXfilename"
    New-VM -VHDPath "$VHDXfilename" -Name "$VMName$i" -Path "$parentpath" -SwitchName "$vSwitchName"
    ## Start-VM "$VMName$i"
}


After some time, my M630 and its 256 GB of RAM was fully loaded with 200 sysprepd VMs

July 30th, 2015 3:23pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics