Guest User

Untitled

a guest
Jan 2nd, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. # Specify vCenter Server, vCenter Server username and vCenter Server user password
  2. $vCenter="lab.asvignesh.in"
  3. $vCenterUser="administrator@vsphere.local"
  4. $vCenterPassword="secretPassword"
  5. #
  6. # Specify number of VMs
  7. $vm_count = "100"
  8. #
  9. # Specify the template
  10. $tempate = "W2k12"
  11. #
  12. # Specify the VM image Customization Specification
  13. $customspecification="AD-Customization"
  14. #
  15. # Specify the datastore
  16. $ds = "vignesh-ds-1"
  17. #
  18. $host = "esxi1.asvignesh.in"
  19. # Specify Virtual Machine & Templates folder
  20. $Folder = "QA"
  21. #
  22. # Specify the VM name
  23. $VM_prefix = "asvignesh-"
  24. #
  25. # End of user input parameters
  26. #
  27. write-host "Connecting to vCenter Server $vCenter" -foreground green
  28. Connect-viserver $vCenter -user $vCenterUser -password $vCenterPassword -WarningAction 0
  29. 1..$vm_count | foreach {
  30. $y="{0:D1}" -f + $_
  31. $VM_name= $VM_prefix + $y
  32. write-host "Creation of VM $VM_name initiated" -foreground green
  33. New-VM -Name $VM_Name -Template $tempate -VMHost $host -Datastore $ds -Location $Folder -OSCustomizationSpec $customspecification -RunAsync
  34. }
Add Comment
Please, Sign In to add comment