Hi,
I use this for deploy my VM
How can i wait also for VM deployment finish?
$task = Get-ContentLibraryItem -ContentLibrary $VMTemplate.ContentLibrary -Name $VMTemplate.name |
New-VM -Name $Computername -VMHost (Get-Cluster $VCENTER.ClusterName | Get-VMHost | Get-Random) `
-ResourcePool (Get-Cluster $VCENTER.ClusterName).ResourcePool -Datastore $Datastore `
-DiskStorageFormat $DiskStorageFormat -RunAsync:$true
$task
Wait-Task -Task $task