Those lines should be in a foreach loop, like the earlier code in the script.
Then the $_ variable will hold the number to be added to the basename.
2..$Count | Foreach {
$vm = Get-VM "$Name$_"while ($vm.PowerState -ne "PoweredOn"){ sleep 5
$vm = Get-VM $vm
}}
This will wait for all VM to be powered on.