VMware Cloud Community
prabuvmware
Enthusiast
Enthusiast

VM Provisioning without template Script.


Hi Friends,

I'm looking for the PowerCLi script which can automate VM provisioning without using template.

User Input will be Hostname, Manual mac ,CPU and Mem..

Solution :

Create a VM using (NewVM) ---> then install the Guest OS (Anyone)

Thx, Waiting for the response.

Reply
0 Kudos
4 Replies
LucD
Leadership
Leadership

You will need at least to give an ESXi hosts as well.

Something like this should do it

$esxName = "MyEsx"
Import-Csv input.csv -UseCulture | %{
 
$vm = New-VM -Name $_.Hostname -NumCPU $_.CPU -MemoryMB $_.MemoryGB -VMHost $esxName
 
Get-NetworkAdapter -VM $vm | Set-NetworkAdapter -MacAddress $_.MAC
}

And for the CSV file it assumes a layout like this

"Hostname","CPU","MemoryGB","MAC"

"testVM","1","2","11:22:33:44:55:66"


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
prabuvmware
Enthusiast
Enthusiast

Hi Lucd,

Thanks for the info. How the script will pickup the data store and stuff...

I'm a beginner to PowerCLi , Please let me know the complete script.


Reply
0 Kudos
LucD
Leadership
Leadership

If you don't specify values for parameters, like for example the datastore, the defaults will be taken.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

prabuvmware
Enthusiast
Enthusiast

Great.Let me try out and let you know the results.

Thanks a lot.

Reply
0 Kudos