Provision multiple VMs from template via PowerCLI

 

OK, so first of all u need to have so things:

1. a VM Template that is already pre configured

2. if you are foing to use windows 2003, xp, u need the sysprep files installed on the vCenter.

3. last thing is a Customization Specification file which is actually ….an answer file to run during the sysprep proccess.

on this example i am using a template name “Template” and a OS Customization file name win2003Prep

i will provision 5 vm’s from a single command with vm000X as naming convention.

Steps:;

a. open powerCli and connect to your vCenter Server:

connect-viserver -server vCenterName -username ‘administrator’ – password ‘password’

b. now u can create multiple VMs from you template using a single command:

# 1..5 | foreach { new-vm -name vm000$_ -vmhost esxi1.vmwarepro.com -Datastore SharedDS -template Template -oscustomizationSpec win2003Prep } | start-VM

c. at this point the vCenter will clone the Template 5 times and will activate the sysprep process.

Regards,

Shay Hyams

Advertisements