@@ -422,13 +422,24 @@ If Azure Image Builder creates a Windows custom image successfully, and you crea
422
422
423
423
#### Default Sysprep command
424
424
```powershell
425
- echo '>>> Waiting for GA to start ...'
425
+ Write-Output '>>> Waiting for GA Service (RdAgent) to start ...'
426
426
while ((Get-Service RdAgent).Status -ne 'Running') { Start-Sleep -s 5 }
427
- while ((Get-Service WindowsAzureTelemetryService).Status -ne 'Running') { Start-Sleep -s 5 }
427
+ Write-Output '>>> Waiting for GA Service (WindowsAzureTelemetryService) to start ...'
428
+ while ((Get-Service WindowsAzureTelemetryService) -and ((Get-Service WindowsAzureTelemetryService).Status -ne 'Running')) { Start-Sleep -s 5 }
429
+ Write-Output '>>> Waiting for GA Service (WindowsAzureGuestAgent) to start ...'
428
430
while ((Get-Service WindowsAzureGuestAgent).Status -ne 'Running') { Start-Sleep -s 5 }
429
- echo '>>> Sysprepping VM ...'
430
- if( Test-Path $Env:SystemRoot\\windows\\system32\\Sysprep\\unattend.xml ){ rm $Env:SystemRoot\\windows\\system32\\Sysprep\\unattend.xml -Force} & $Env:SystemRoot\\System32\\Sysprep\\Sysprep.exe /oobe /generalize /quiet /quit
431
- while($true) { $imageState = Get-ItemProperty HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State | Select ImageState; if($imageState.ImageState -ne 'IMAGE_STATE_GENERALIZE_RESEAL_TO_OOBE') { Write-Output $imageState.ImageState; Start-Sleep -s 5 } else { break } }
431
+ Write-Output '>>> Sysprepping VM ...'
432
+ if( Test-Path $Env:SystemRoot\system32\Sysprep\unattend.xml ) {
433
+ Remove-Item $Env:SystemRoot\system32\Sysprep\unattend.xml -Force
434
+ }
435
+ & $Env:SystemRoot\System32\Sysprep\Sysprep.exe /oobe /generalize /quiet /quit
436
+ while($true) {
437
+ $imageState = (Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State).ImageState
438
+ Write-Output $imageState
439
+ if ($imageState -eq 'IMAGE_STATE_GENERALIZE_RESEAL_TO_OOBE') { break }
440
+ Start-Sleep -s 5
441
+ }
442
+ Write-Output '>>> Sysprep complete ...'
432
443
```
433
444
#### Default Linux deprovision command
434
445
0 commit comments