Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Specify vCenter Server, vCenter Server username and vCenter Server user password
- $vCenter="lab.asvignesh.in"
- $vCenterUser="administrator@vsphere.local"
- $vCenterPassword="secretPassword"
- #
- # Specify number of VMs
- $vm_count = "100"
- #
- # Specify the template
- $tempate = "W2k12"
- #
- # Specify the VM image Customization Specification
- $customspecification="AD-Customization"
- #
- # Specify the datastore
- $ds = "vignesh-ds-1"
- #
- $host = "esxi1.asvignesh.in"
- # Specify Virtual Machine & Templates folder
- $Folder = "QA"
- #
- # Specify the VM name
- $VM_prefix = "asvignesh-"
- #
- # End of user input parameters
- #
- write-host "Connecting to vCenter Server $vCenter" -foreground green
- Connect-viserver $vCenter -user $vCenterUser -password $vCenterPassword -WarningAction 0
- 1..$vm_count | foreach {
- $y="{0:D1}" -f + $_
- $VM_name= $VM_prefix + $y
- write-host "Creation of VM $VM_name initiated" -foreground green
- New-VM -Name $VM_Name -Template $tempate -VMHost $host -Datastore $ds -Location $Folder -OSCustomizationSpec $customspecification -RunAsync
- }
Add Comment
Please, Sign In to add comment