Hello,
I have a script that currently builds a server to user input specs. When the server is deployed it goes through the sysprep process to input all the custimization, right now I'm using a wait timer to account for the sysprep time. (Other functions such as software installs etc occure after the sysprep process).
But i dont like using a wait timer as it can cause problems when sys prep takes longer than the wait timer, can anyone suggest a way after the server is built to account for the time to wait for sys prep to finish before moving on to other installs on the OS?
Vitali did a great post on that, see Waiting for OS customization to complete
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
New-VM -Name $displayname -Location $vclocation -ResourcePool $cluster -Datastore $datastore -Template $sourcetemplate -OSCustomizationspec Tempspec -HARestartPriority $haprio -DiskStorageFormat Thick
remove-OSCustomizationSpec Tempspec -confirm:$false | out-null
UpdateVMSettings | out-null
write-host "Starting server $displayname"
get-vm $displayname | start-vm
write-host "Waiting for sysprep to finish before proceeding further."
start-sleep -s 900
Updatetools | out-null
Above is an example of the script. It waits 900 seconds before installing tools on the OS. But I'd like to find a better way to identify when the OS is done sys prepping to reduce errors or potential errors.
Vitali did a great post on that, see Waiting for OS customization to complete
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Great aritcle! Really appreciate it.