VMware {code} Community
svijay
Contributor
Contributor

Script need to deploy a VM from a template

Hi All,

greetings !

I am pretty new to vmware,  It would be great if any of you could provide me with a Script to Deploy VM from an existing VM template ?

The VM templates resides on a ESXserver part of a DATACENTER , the Datacenter is on a VC(virtual center server) & the script should be able to handle deploying the Template to a different Datacenter under the same VC & also have provision to specify the <datastore> for deploying VM.

Thanks in advance !

Regards,

Vijay

0 Kudos
12 Replies
HaraldJensas
Contributor
Contributor

Hi,

I wrote this script for vSpehere 4.1 last year to automatically redeploy a pool of Citrix VMs from a template.

Tried to make it generic, with a lot of options, so I belive it should work for you too. Smiley Happy

Best Regards

Harald

0 Kudos
svijay
Contributor
Contributor

Hi Harald,

That was a pretty quick, Let me try your script, I will ask for more help if i am stuck Smiley Happy

regards,

Vijay

0 Kudos
HaraldJensaas
Contributor
Contributor

How dit it go?

0 Kudos
Ganapathy
Contributor
Contributor

is it a PowerShelll Script?...

I am unable to execute thru PowerGUI...

0 Kudos
HaraldJensaas
Contributor
Contributor

This is a Perl script.

0 Kudos
Ganapathy
Contributor
Contributor

Could you assist how can i run this script...I downloaded perl software from activescript site...

Let me know how i have to run it...Is it worked for VMware 4.1 version

0 Kudos
vLarus
Enthusiast
Enthusiast

This should help:

http://www.kasraeian.com/2012/05/template-deploy-script/

Good luck.

vmice.net
0 Kudos
Ganapathy
Contributor
Contributor

Hi Larus Hjartarson,

Excellent, i am able to deploy machine...this helps me a lot...

I am plannign to incorporate few things...

1. Assign IP to 1 or more NIC according to our requirement

2. Join Domain with our credential

3. All input it need to fetch from CSV (we are planning to avoid manual intervention).

Could you assist me on this.

Regards,

Ganapathy S

0 Kudos
Kasraeian
Expert
Expert

Hi Ganapathy,

For assigning IP to VMs and joining them to the domain, you can use "Customization Specification" in your vCenter under "Management" section.

Also you can check bellow links, hope they helps:

link #1, link #2

Thanks vLarus for mentioning

If you found this note/reply useful, please consider awarding points for "Correct" or "Helpful" If there's any mistake in my notes, please correct me! Sohrab Kasraeianfard | http://www.kasraeian.com | @Kasraeian
0 Kudos
Kasraeian
Expert
Expert

Dear Ganapathy,

I've updated previous script so it (v0.4) can accept ".csv" files as an input, hope it be can do what you looked for.

Bellow is a sample of ".csv" file which can be used for creating new VMs.

Name,Template,VMHost,Datastore,ResourcePool,vApp,CustomizationProfile,StartState
Test-vm-1,Template-XP,vmhost-001-fqdn,localdatastore,RP-01,none,WinXP-CP,Yes
Test-vm-2,Template-XP,vmhost-001-fqdn,VMX-LUN-001,RP-01,none,WinXP-CP,No
Test-vm-3,Template-2003,vmhost-002-fqdn,VMX-LUN-002,RP-02,none,Win2003-CP,No
Test-vm-4,Template-2008,vmhost-003-fqdn,localdatastore,RP-03,none,Win2008-CP,Yes
Test-vm-5,Template-2008R2,vmhost-004-fqdn,VMX-LUN-001,none,Test-vApp,Win2008-CP,Yes
Test-vm-6,Template-XP,vmhost-010-fqdn,localdatastore,RP-04,Test-vApp,WinXP-CP,Yes

If you found this note/reply useful, please consider awarding points for "Correct" or "Helpful" If there's any mistake in my notes, please correct me! Sohrab Kasraeianfard | http://www.kasraeian.com | @Kasraeian
0 Kudos
svijay
Contributor
Contributor

Hi, I have limited to no acess to emails, Anything Urgent, I can be reached on +91 98456 14413

Regards,

Vijay

0 Kudos
samsvmware
Enthusiast
Enthusiast

Can you able to provide the what are all the parameter you have passed to this script .Which help me to proceed further on this

0 Kudos