I am using script created by RvdNieuwendijk
https://www.vmadmin.co.uk/resources/48-vspherepowercli/272-vspherevmtemplatecsv
Input CSV columns are :
Name
Template
DestinationHost
CustomSpec
NumCpu
MemoryMB
Actual script is :
Connect-VIServer vcenter1.vmadmin.co.uk
$VirtualMachinesCSV = "C:\VMsFromTemplate.csv"
$strDescription = "Created from template and CSV by Andy Barnes"
$VirtualMachinesDetails = Import-CSV $VirtualMachinesCSV
$VirtualMachinesDetails | %{ New-VM -Name $_.Name -Template $(Get-Template $_.Template) -VMHost $(Get-VMHost $_.DestinationHost) -OSCustomizationSpec $(Get-OSCustomizationSpec $_.CustomSpec) }
$VirtualMachinesDetails | %{ Set-VM -VM $_.Name -NumCpu $_.NumCpu -MemoryMB $_.MemoryMB -Description $strDescription -Confirm:$false }
$VirtualMachinesDetails | %{ Start-VM -VM $_.Name -Confirm:$false }
This is working fine for me with given information, however I am looking to add some more parameters which I am not able to find with SET-VM command like to specify Datastore, Multiple NICs, Multiple disks, Port groups to attach, and folder.
Thanks in advance.
Hello, vijayrana968-
Here are some tips that should get you going in the right direction to update your code to support specifying those additional items:
Datastore:
folder
Multiple NICs, and specify PortGroups
Multiple disks
That get you there?
Thanks for inpu, let me try this.