VMware Cloud Community
PSC_INS
Contributor
Contributor

Spreadsheet to create multiple VM from Template

Hi

i have seen this

and i find i great. The only thing is, i am new to vitoolkit and i do not know how to modify this sheet to create the vms from a template. So can anybody please explain me what to do to get it to work?

Thx

Peter

0 Kudos
4 Replies
olan025
Enthusiast
Enthusiast

PSC_INS

I don't currently have a great testing environment to go through it.

But you need to highlight A2 on the second worksheet...

in the New-VM commands,,, you have to add the -template parameter then specify a new column in the spreadsheet labeled template.

new-vm -template $f.template

I've made the changes to this one, you can test it out.

Like i said, I am not direclty able to test... if I can i will.

0 Kudos
meistermn
Expert
Expert

what does parameters.csv means in this script

0 Kudos
Rogg23
Contributor
Contributor

Parameters.csv is a file of comma seperated values containing the values specifed for the new virtual machines in the spreadsheet.

This csv file is generated by a VB macro in the spreadsheet.

These parameters are then read by the powershell script to generate the new VMs.

0 Kudos
admin
Immortal
Immortal

Hello,

I m sorry, I m not a scripting guy.

What should I change to specify the datastore for each vm:

foreach ($f in (import-csv "parameters.csv")) {

if ($f."Host Name") {

$vmhost = get-vmhost $f."Host Name"

} else {

$vmhost = get-vmhost

}

if ($f."Resource Pool") {

new-vm -host $vmhost -name $f.Name -diskmb ($f."Disk Size (GB)" * 1024) -memorymb \

$f.Memory -networkname $f."Network Name" -resourcepool \

(get-resourcepool $f."Resource Pool") -runasync

} else {

new-vm -host $vmhost -name $f.Name -diskmb ($f."Disk Size (GB)" * 1024) -memorymb \

$f.Memory -networkname $f."Network Name" -runasync

}

}

Many thanks in advance.

Best regards

0 Kudos