<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Need script for multiple vm deployment in Technical Community Resources and Help Discussions</title>
    <link>https://communities.vmware.com/t5/Technical-Community-Resources/Need-script-for-multiple-vm-deployment/m-p/2956599#M4241</link>
    <description>&lt;P&gt;I am planning to deploy multiple&amp;nbsp; windows vms from existing vm template and the script should look for all input from csv files .&lt;/P&gt;&lt;P&gt;1. vm should deploy from template&lt;/P&gt;&lt;P&gt;2. modify the configuration of the vm based on CSV file&lt;/P&gt;&lt;P&gt;3.genarlize sid&amp;nbsp;&lt;/P&gt;&lt;P&gt;4.rename the vm as mentioned in csv file&lt;/P&gt;&lt;P&gt;5.set ip address and dns&amp;nbsp; for single nic&amp;nbsp; as mentioned in csv&lt;/P&gt;&lt;P&gt;6. join the server to domain&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wrote the below code its working as expected till vm deploy and configuration modification i am looking further codes to work as above requirement kindly help&amp;nbsp;&lt;/P&gt;&lt;P&gt;# Connect to vCenter Server&lt;BR /&gt;Connect-VIServer -Server "vcsa6.mylab.local" -User "Administrator@vsphere.local" -Password "Welcome@xxx"&lt;/P&gt;&lt;P&gt;# Import the CSV file containing the VM specifications and domain information&lt;BR /&gt;$csv = Import-Csv "C:\Users\raj\Desktop\Vmdeployment automation\input.csv"&lt;/P&gt;&lt;P&gt;# Loop through each row in the CSV file and create a VM&lt;BR /&gt;foreach ($row in $csv)&lt;BR /&gt;{&lt;BR /&gt;&lt;BR /&gt;$vmName = $row.VMname&lt;BR /&gt;$esxiHost = $row.esxihost&lt;BR /&gt;$cpu = $row.cpu&lt;BR /&gt;$memory = $row.memory&lt;BR /&gt;$datastore = $row.datastore&lt;BR /&gt;$vmFolder = $row.vmfolder&lt;BR /&gt;$ipv4Address = $row.ipaddress&lt;BR /&gt;$subnetMask = $row.subnetmask&lt;BR /&gt;$gateway = $row.gateway&lt;BR /&gt;$pdns = $row.pdns&lt;BR /&gt;$sdns = $row.sdns&lt;BR /&gt;$template = $row.template&lt;BR /&gt;$domainName = $row.domainname&lt;BR /&gt;$domainUser = $row.domainuser&lt;BR /&gt;$domainPassword = $row.domainpassword&lt;BR /&gt;$adminPassword = $row.adminpassword&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;# Create the new VM from the template&lt;BR /&gt;$vm = New-VM -Name $vmName -Template $template -VMHost $esxiHost -Datastore $datastore -Location $vmFolder -Confirm:$false -RunAsync&lt;BR /&gt;&lt;BR /&gt;$vm = Wait-Task $vm&lt;BR /&gt;&lt;BR /&gt;# Power on the new VM&lt;BR /&gt;Start-VM -VM $vm -Confirm:$false -RunAsync&lt;BR /&gt;&lt;BR /&gt;# Wait for the VM to power on&lt;BR /&gt;do {&lt;BR /&gt;Start-Sleep -Seconds 5&lt;BR /&gt;} until ((Get-VM -Name $vmName).PowerState -eq "PoweredOn")&lt;/P&gt;&lt;P&gt;Write-Host "$vmName is now powered on."&lt;/P&gt;&lt;P&gt;# Set the number of CPUs and memory for the new VM&lt;BR /&gt;Set-VM -VM $vmName -NumCpu $cpu -MemoryGB $memory -Confirm:$false&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 25 Feb 2023 10:53:27 GMT</pubDate>
    <dc:creator>Natarajvd</dc:creator>
    <dc:date>2023-02-25T10:53:27Z</dc:date>
    <item>
      <title>Need script for multiple vm deployment</title>
      <link>https://communities.vmware.com/t5/Technical-Community-Resources/Need-script-for-multiple-vm-deployment/m-p/2956599#M4241</link>
      <description>&lt;P&gt;I am planning to deploy multiple&amp;nbsp; windows vms from existing vm template and the script should look for all input from csv files .&lt;/P&gt;&lt;P&gt;1. vm should deploy from template&lt;/P&gt;&lt;P&gt;2. modify the configuration of the vm based on CSV file&lt;/P&gt;&lt;P&gt;3.genarlize sid&amp;nbsp;&lt;/P&gt;&lt;P&gt;4.rename the vm as mentioned in csv file&lt;/P&gt;&lt;P&gt;5.set ip address and dns&amp;nbsp; for single nic&amp;nbsp; as mentioned in csv&lt;/P&gt;&lt;P&gt;6. join the server to domain&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wrote the below code its working as expected till vm deploy and configuration modification i am looking further codes to work as above requirement kindly help&amp;nbsp;&lt;/P&gt;&lt;P&gt;# Connect to vCenter Server&lt;BR /&gt;Connect-VIServer -Server "vcsa6.mylab.local" -User "Administrator@vsphere.local" -Password "Welcome@xxx"&lt;/P&gt;&lt;P&gt;# Import the CSV file containing the VM specifications and domain information&lt;BR /&gt;$csv = Import-Csv "C:\Users\raj\Desktop\Vmdeployment automation\input.csv"&lt;/P&gt;&lt;P&gt;# Loop through each row in the CSV file and create a VM&lt;BR /&gt;foreach ($row in $csv)&lt;BR /&gt;{&lt;BR /&gt;&lt;BR /&gt;$vmName = $row.VMname&lt;BR /&gt;$esxiHost = $row.esxihost&lt;BR /&gt;$cpu = $row.cpu&lt;BR /&gt;$memory = $row.memory&lt;BR /&gt;$datastore = $row.datastore&lt;BR /&gt;$vmFolder = $row.vmfolder&lt;BR /&gt;$ipv4Address = $row.ipaddress&lt;BR /&gt;$subnetMask = $row.subnetmask&lt;BR /&gt;$gateway = $row.gateway&lt;BR /&gt;$pdns = $row.pdns&lt;BR /&gt;$sdns = $row.sdns&lt;BR /&gt;$template = $row.template&lt;BR /&gt;$domainName = $row.domainname&lt;BR /&gt;$domainUser = $row.domainuser&lt;BR /&gt;$domainPassword = $row.domainpassword&lt;BR /&gt;$adminPassword = $row.adminpassword&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;# Create the new VM from the template&lt;BR /&gt;$vm = New-VM -Name $vmName -Template $template -VMHost $esxiHost -Datastore $datastore -Location $vmFolder -Confirm:$false -RunAsync&lt;BR /&gt;&lt;BR /&gt;$vm = Wait-Task $vm&lt;BR /&gt;&lt;BR /&gt;# Power on the new VM&lt;BR /&gt;Start-VM -VM $vm -Confirm:$false -RunAsync&lt;BR /&gt;&lt;BR /&gt;# Wait for the VM to power on&lt;BR /&gt;do {&lt;BR /&gt;Start-Sleep -Seconds 5&lt;BR /&gt;} until ((Get-VM -Name $vmName).PowerState -eq "PoweredOn")&lt;/P&gt;&lt;P&gt;Write-Host "$vmName is now powered on."&lt;/P&gt;&lt;P&gt;# Set the number of CPUs and memory for the new VM&lt;BR /&gt;Set-VM -VM $vmName -NumCpu $cpu -MemoryGB $memory -Confirm:$false&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Feb 2023 10:53:27 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/Technical-Community-Resources/Need-script-for-multiple-vm-deployment/m-p/2956599#M4241</guid>
      <dc:creator>Natarajvd</dc:creator>
      <dc:date>2023-02-25T10:53:27Z</dc:date>
    </item>
  </channel>
</rss>

