Good morning AskPerf! Ramesh here from the Microsoft Platforms Support Team. I am blogging today about an issue I recently worked. This particular issue was with the creation of an Unmanaged Virtual machine-based desktop pool collection on a Windows 2012 Server. When I attempted to create a Virtual machine-based desktop pool collection, the following error appeared:
“The VMHostAgent service timed out while waiting for the newly provisioned virtual desktop to start”
the error above is a generic one, and indicates that Remote Desktop did not receive a notification from Hyper-V that the VM started. You likely either have a Hyper-V problem or a problem with the VM itself and further troubleshooting is necessary.
During our troubleshooting we noticed the first virtual machine was stuck at “Setup is preparing your computer for first use” and this occurred after the first reboot of the virtual machine during the installation. We collected Panther logs from the virtual machine to identify the cause of the setup issue and found out the system was stuck at executing setupcomplete.cmd, a custom post setup script. This script was part of the windows image from where the template virtual machine was installed. We deleted this script from the template virtual machine after setting up the template virtual machine and ran the Virtual machine-based desktop pool collection wizard and it completed successfully.
We also tried to repro the same error and we could do it by disabling the DHCP server. This produced the same error because the new virtual machine was not getting the IP address and was unable to reach a DC. In order to identify the cause for this error during Virtual machine-based desktop pool creation, watch the first virtual machine in the Virtual machine-based desktop pool creation process for any abnormal behaviors. In normal conditions the virtual machine will complete the setup. create a snap shot of the virtual machine, put the virtual machine into saved state and continue to the second virtual machine.