We have a powercli script that intermittently fails to join the domain and thus subsequent steps fail. It is using the new-vm commandlet to clone a VM using a customization spec. The VMs NIC is not connected causing the failure. I can see in the Guestcust.log that it is trying to connect the nic 5 times and giving up:
Trying to connect network interfaces, attempt 5
Rpci: Sending request='deployPkg.update.state 4 103 C:\WINDOWS\TEMP\vmware-imc\guestcust.log@4000'
Rpci: Sent request='deployPkg.update.state 4 103 C:\WINDOWS\TEMP\vmware-imc\guestcust.log@4000', reply='Unknown command', len=15, status=0
Got VMX response 'Unknown command'
Unable to set customization status in vmx.
Can't connect network interfaces after 5 attempts, giving up
This last time, I found that DRS had moved the VM to another host in the cluster 37 seconds after powering it on. I suspect this to be the cause of the problem. This would explain the intermittent nature of the problem, however, I do not have proof that this happened during the other failures. If so, it is a VMware bug. While I could disable the master VM from DRS and re-enable it via script after the cloning is complete, having to do such a thing is totally bogus.
Any ideas of anything else that might be the cause of the nic to not enable? Or confirmation that a DRS vmotion would cause this failure?
Hi GalNeb
Welcome to the communities.
First you have to make sure that your NIC don't have any issues .
2nd services,firewall & port settings .
Hope these steps may help to resolve your problem .
Did you ever figure this out? I just had a similar problem deploying a windows 8 machine (there was no customization started/succeeded in the events for the vm)
Looking in the logs it seems a vmotion also occurred when i deployed a windows 2008 r2 machine but that one seemed to be ok
thanks
We have seen this a number of times. The fix has been to restart the management services on the host where it failed. In some cases we have not even been able to connect the NIC until we have restarted services. We have not determined what is causing the management services to not work correctly. BTW, be sure to disable HA before restarting services, as this will cause an HA event.
Talking about VMotion issues: On a somewhat similar note, we have some rather long Windows scripts that install software that are being triggered by a PowerCLI Invoke-VMScript command. The PowerCLI script prematurely stops when the VM is VMotioned by DRS. Apparently, PowerCLI is monitoring the script via calls to the host on which it resides; if it moves, it loses contact and the PowerCLI sees that as the script being completed. The answer was to add commands before and after to Invoke-VMScript command to disable the VM from DRS and then re-enable it when the script is complete.
I'm actually using VMware Orchestrator to deploy my vms intead of PowerCLI (doing soap/rest calls to interface with another system). This is the first time I've had the nic issue but I've seen other random partial failures in the past. I'm wondering if it's also related to a machine being vmotioned.
I'm also at the stage where I'm starting to use orchestrator to run install things post deployment so I'll keep an eye out.
Are you able to share the part of your script that disables the VM from DRS? It would probably help me figure out the code needed to accomplish the same thing in Orchestrator (I have some auto generated stuff but it seems to be doing more changes than what is actually necessary)
Thanks
To disable/re-enable drs for a vm:
$myVC=MyVMName
Get-VM $myVC | Set-VM -DrsAutomationLevel Disabled -Confirm:$false
Invoke-VMScript .....
Get-VM $myVC | Set-VM -DrsAutomationLevel AsSpecifiedByCluster -Confirm:$false
Is there an equivalent command in PyVmomi? To disable vmotion temporarily?