You didn't say how you create the new VM, from scratch or as a clone ?
Anyway, afaik there is currently no cmdlet switch to let you specify that a cloned VM shall be powered on after creation.
When you use the underlying API (CloneVM_Task) you have a property (poweron) in the VirtualMachineCloneSpec object, that lets you specify this.
In summary, not with any of the current cmdlets.
With the API Method you can define an automatic poweron with the clone method.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You didn't say how you create the new VM, from scratch or as a clone ?
Anyway, afaik there is currently no cmdlet switch to let you specify that a cloned VM shall be powered on after creation.
When you use the underlying API (CloneVM_Task) you have a property (poweron) in the VirtualMachineCloneSpec object, that lets you specify this.
In summary, not with any of the current cmdlets.
With the API Method you can define an automatic poweron with the clone method.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I'm using a New-VM in a PowerShell function.
New-VM -Name $($ServerAction.vmName) -Template $($ServerAction.Template) -OSCustomizationSpec $($ServerAction.OSCustomSpec) -Datastore $($ServerAction.DatastoreCluster) -ResourcePool $($ServerAction.ResourcePool) -Location $($ServerAction.Location) -Notes $($Description) -RunAsync
Then I'm afraid you will have to revert to the API if you want the VM to power on automatically.
But the alternative is to pipe ('|') the result of the New-VM cmdlet you are using to the Start-VM cmdlet.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Won't Start-VM fail if the VM is still being cloned from template? If I pipe to Start-VM, I assume I can't create the VMs asynchronously, correct?
Yes, you'll have to drop the RunAsync (missed that switch in your line of code).
But why are you using the RunAsync here, does the actual cloning from a template take that long ?
Remember the customisation will only start when the VM is powered on.
You can of course also monitor the Task that was returned when you launched New-VM with the RunAsync switch.
You can do this with the Wait-Task cmdlet, or you can check the State of the Task
See Re: Script to wait for Clone Task to complete
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
The cloning takes about 10-20 minutes per VM depending which physical datacenter I'm sending it to. That's a long time to have the shell hanging out while 10 VMs are created synchronously. I'm thinking the API will be my best bet for now. I had the wait-task working but didn't want to have to wait for each VM. I really appreciate your help and will touch base on the API once I look it over and test.