I am working in a win2012 (hyper-v3.0) Single-host set up 30 virtual machines, on the internet to find the http://greece760.blog.51cto.com/660798/1277325 blog, has been transformed, Implementing a VHDX hard disk file creates a standalone virtual machine, instead of creating a virtual machine like that man's differencing disk, and can take the IP address as a virtual machine file.
#hyper-V host virtual machine root path $hypervrootpath= "E:\HyperV\" #hyper-V virtual Machine the same name $nodename= "10.1.1." #建立虚拟机数量 $FlagVM =11# virtual machine nic name $networkname= "vm_local_14" #虚拟机cpu核数 $LogicPrecesserCount =4# virtual machine Memory $momerycount=4gb# template location $MasterDiskPath = "D:\TEMPLATE\DXT-VHCS1-WIN2003.VHDX" $NodeNameFullName = "" $VMName = "" $IPID =100for ($i =9; $i - le $FlagVM, $i + +) {$IPend = $IPID + $i $folderpath = $HyperVRootPath + $NodeName + $IPend #create vm sub-foldermkdir $FolderPath #create vm disk$nodenamefullname = $NodeName + $IPend + ". Vhdx" $VMNodePath = $ folderpath + "\" + $NodeNameFullNameWrite-host $VMNodePath #new-vhd -parentpath $MasterDiskPath -Path $VMNodePath -DifferencingCopy-Item $MasterDiskPath $ vmnodepath#configure vm$vmname = $NodeName + $IPendNew-vm -name $VMName -path $FolderPath -MemoryStartupBytes $Momerycount -vhdpath $VMNodePath -SwitchName $NetworkNameSet-vmprocessor $VMName - count $LogicPrecesserCountSet-vmnetworkadapter $VMName -routerguard on#start vm# start-vm -name $VMName}
After running the above code, set up 3 virtual machines named 10.1.1.109, 10.1.1.110, 10.1.1.111
This article is from the "Feel Yourself" blog, make sure to keep this source http://wonitazansa.blog.51cto.com/692068/1572674
win2012 single-Homed PowerShell batch build virtual machines