I am deploying about 135 VM's from a single template using powercli from a CSV file.
Each line in the CSV has a login, course, section, instructor
Example...
Login Course Section Instructor
123456 EE123 5555 Foo
Here is the script
Connect-VIServer -Server 10.0.0.60 -Credential (Get-Credential)
$Users = Import-Csv c:\CSV\Data.csv
foreach ($User in $Users) {
$Login = $User.Login
$Course = $User.Course
$Section = $User.Section
$Instructor = $User.Instructor
$ResPool = $User.Section + " " + $User.Instructor
New-VM -VMHost 10.0.0.10 -Name $Login -ResourcePool "$ResPool" -Template "VM-template" -Datastore "datastore1"
write "$Login Created" | Out-File "log.txt" -append
}
Disconnect-VIServer -Server 10.0.0.60 -confirm:$false
I am trying to make the datastore a little cleaner when I deploy these machines, and put all the machines in a folder located in the datastore eg. datastore1\spring2013\EE123\ (would actually like to have $Course in place of EE123)
Can someone help me out with this.
Thanks in advance