I'm seeking advice for a perplexing issue I've encountered during a project where I'm using a PowerCLI script to generate lab environments for my students. The script is designed to set up a resource pool, VM folder, dvPortGroup, and the necessary permissions. It also handles user account creation and various other requirements, which includes cloning a pre-configured, sysprep'ed Windows 10 image and applying a VM customization specification. (Note: The Template is not deployed from a content library.)
Despite ensuring the image is correctly configured and the sysprep process is accurate, I've been experiencing unpredictable deployment results. Out of every 15 deployments, only around 6 are successful. Sometimes, during the VM booting process, an error message pops up stating "Windows installation cannot continue etc..". On other occasions, the VM boots and configures as expected.
In an effort to overcome this, I crafted an additional script that redeployed the image until successful. However, this is far from ideal; in one instance, it took four deployments for a user's setup to succeed.
I've tried reconstructing the original image twice, considering I might have made an error during the sysprep process. However, this doesn't seem to be the case as the image works most of the time.
I'm at a loss about where to start troubleshooting this issue, so I'm reaching out here in the hope someone may have insights or suggestions. Can anyone help?