mars0077
Enthusiast
Enthusiast

Deploying VM from content library timeout.

Hello everyone,

I have PowerCLI script that creates a vm from a content library. The issue that I am running into is that the script
times out with a "The task was canceled by a user." 

I think the issue has to do with the Deploy OVF template task not being synchronized with the transfer files task. It takes about 7 minutes for the file transfers to complete so the powercli script times out even though all OVF associated tasks in vCenter are still continuing in the vSphere client. This causes all other steps in my script to fail because the VM is not fully deployed yet. 

How can I ensure that the script does not go to the next steps until the OVF has been deployed successfully? Below is the code that
applies to the new vm creation.

$contentLibraryItem = Get-ContentLibraryItem -Name 'WINTMP'

New-VM -Name $vm -ContentLibraryItem $contentLibraryItem -resourcePool $cluster -location $folder -Datastore $datastore -DiskStorageFormat "Thick" -DrsAutomationLevel "Manual" -confirm:$false

I have tried the suggestion from this link but it didn't work. 

https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/Creating-new-VM-with-async-fails-with-...

Thanks!

Reply
0 Kudos
LucD
Leadership
Leadership

It might be a long shot, and yes, KB88928 is about exporting, but that resolution in there might help.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Reply
0 Kudos
mars0077
Enthusiast
Enthusiast

Thanks Luc! That makes sense.

So is there no way to pause the process until all those tasks are done at the script level?

Reply
0 Kudos
LucD
Leadership
Leadership

Not that I know off I'm afraid.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
mars0077
Enthusiast
Enthusiast

Understood. Thanks for your feedback. 

Reply
0 Kudos