Hi @HPN
I am still working on this one but am glad to share what I have so far to assist you:
Link to CSV for creating multiple VM’s
https://drive.google.com/file/d/1yvxXVAc7mn4NHrZmv02boTb4lVhV4JJK/view?usp=sharing
https://github.com/cloudcor-ntnx/ntnx-ps-advanced/blob/master/new-vm-from-csv.ps1
It essentially loads a csv files with the values necessary and then does a foreach loop on each object in the CSV.
Hi @danny_sre
Thanks for your quick response. Can you please allow my gmail ID: hara.nayak@gmail.com access to the google drive as you mentioned above?
For running this script do we need to have special permission in vmware or Nutanix environment. I have the full Admin access on Hypervisor level but read only access in Nutanix.
@HPN
Based off your response I would then recommend writing the script for PowerCLI and connect to the esxi part of the environment for creating the new VM’s
https://code.vmware.com/forums/2530/vsphere-powercli#580519
$fileName = 'whatever.csv'
foreach($vmLine in (Import-Csv -Path $fileName -UseCulture)){
$vm = New-VM -Name $vmLine.Server -VMHost $vmLine.EsxHost -Datastore $vmLine.Datastore -Template $vmLine.Template
Get-NetworkAdapter -VM $vm | Set-NetworkAdapter -NetworkName $vmLine.Network -StartConnected
}
Hi @danny_sre
I checked the link but how we can control the number of builds getting to a specific container?
@HPN
The containers are mapped to the esxi host as datastores, so you would simply provide a container name that correlates to the esxi datastore:
Datastore $vmLine.Datastore
Thanks Dan. So if I got it correct i need to create a CSV file in the below format
Machine Name | EsxHost | Datastore | Template | Network |
And then use the script to consume the above CSV file to build the machines. Need to provide the VLAN information in network field and container information in Datastore field
$fileName = 'whatever.csv'
foreach($vmLine in (Import-Csv -Path $fileName -UseCulture)){
$vm = New-VM -Name $vmLine.Server -VMHost $vmLine.EsxHost -Datastore $vmLine.Datastore -Template $vmLine.Template
Get-NetworkAdapter -VM $vm | Set-NetworkAdapter -NetworkName $vmLine.Network -StartConnected
}