win2012 single-Homed PowerShell batch build virtual machines

Source: Internet
Author: User


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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.