The 2nd reboot is most probably due to the OS customisation.
In that case, I wait till the CustomizationSucceeded (or CustomizationFailed) event has appeared in the eventlog (Get-VIEvent)
------------------------------
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
------------------------------
Original Message:
Sent: Sep 10, 2024 07:16 AM
From: LFOD77
Subject: New VM from Template reboots twice at Start-Up
When my VMBuild script starts the VM created from Template (with minimal spec customization) it reboots twice which causes my next set of code, "Invoke-VMScript" steps to initialize/format additional drives. Any idea how I can prevent the Windows template from rebooting, or any other suggestions?