VMware Cloud Community
KThorlund
Enthusiast
Enthusiast

Enable NIC during VM cloning - NIC is not active as expected.

Hello, 

I am using the vRO 7.6 built-in workflow, "Clone, Windows with single NIC and credential" to clone and deploy new machines. 

As input to the "Clone, Windows with single NIC and credential" I specify the network the NIC should be connected to. The same network is actually also set in the template where the NIC is also enabled. 

Sometimes the deployment fails due to Sysprep is not able to join the machine to the domain. 

I have found it happens because the NIC is not enabled during the cloning where by the OS (Windows) starts up without an interface causing Sysprep to fail. 

 

Has anyone seen similar - maybe a workaround to enable the NIC during the cloning?

 

Or do I have to deploy it in a sequence of the workflows

Clone virtual machine from properties
Clone virtual machine, no customization
Customize virtual machine from properties

?

Regards, Kjeld 

Labels (1)
0 Kudos
1 Reply
KThorlund
Enthusiast
Enthusiast

Of course, an easy work around was to dublicate the clone workflow and add a script prior to the Sysprep. It is good enough for me. 

This will ensure the NIC is enabled when the VM boots for Sysprep. 

 

 

devices = tempNewVm.config.hardware.device;
for(i in devices)
{
   label = (devices[i].deviceInfo.label).toLowerCase();
   if ( label.indexOf("network") >= 0 )
   {
      confSpec = new VcVirtualDeviceConfigSpec();
      confSpec.operation = VcVirtualDeviceConfigSpecOperation.edit;
      confSpec.device = devices[i];
      confSpec.device.connectable.startConnected = true;
      confSpec.device.connectable.connected = true;
      spec = new VcVirtualMachineConfigSpec();
      spec.deviceChange = [confSpec];

      netTask = tempNewVm.reconfigVM_Task(spec);
      netResult = System.getModule("com.vmware.library.vc.basic").vim3WaitTaskEnd(netTask, true, 5) ;
   }
}