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.
what does parameters.csv means in this script
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.
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