The logic of that script is not clear to me.
You are reading (imnporting) the specifications from a CSV file -> ok
Then you extract from that imported data, the Name property -> ok
But then you are trying to create $vm_count (not initialised) times a VM, and as the name of that VM you give the complete array of names from the CSV that was imported earlier.
If I interpret it correctly, what you are trying to do, could be done as
The Import-Csv will read the CSV file and send each row as an object.
We loop (% alias for ForEach-Object) through all these rows.
A row object is represented as $_ inside the loop, so we can refer to a property of that row with the standard notation, i.e. $_.Name.
# Specify vCenter Server, vCenter Server username and vCenter Server user password
Write-Host 'Please specify vCenter Server and enter credentials' -foreground green
$vc = Read-Host 'Connect to which vCenter Server?'
Write-Host “Connecting to vCenter Server $vc” -ForegroundColor green
Connect-VIServer -Server $vc
$CSVPath = "$ScriptRoot\PROD_VMRequestTEST.xlsx.csv"
# Specify the vSphere Cluster
$Cluster = 'vSphere 5.5 RND'
$esx = Get-Cluster $Cluster | Get-VMHost -State connected
Import-Csv -Path $CSVPath | %{
Write-Host “Creation of VM $_.Name initiated” -ForegroundColor green
New-VM -Name $_.Name -VMHost ($esx | Get-Random)
Write-Host “Power On of the VM $_.name initiated” -ForegroundColor green
Start-VM -VM $_.Name -confirm:$false -RunAsync
}