Sysprep in packer build not ending

Hello,

I’m starting a Github action to build a image with packer. But when the sysprep starts it seems not to end anymore.

Any advise would be great.

Last part of my code :

provisioner “powershell” {

inline = \[

  "while ((Get-Service RdAgent).Status -ne 'Running') { Start-Sleep -s 5 }",

  "while ((Get-Service WindowsAzureGuestAgent).Status -ne 'Running') { Start-Sleep -s 5 }",

  "& $env:SystemRoot\\\\System32\\\\Sysprep\\\\Sysprep.exe  /unattend:A:\\\\Autounattend.xml /quiet /generalize /oobe /shutdown",

  "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 10  } else { break } }"

\]

}

Hi! I have just post a similar question in this forum. From what I have read around, the only way to run sysprep is to use a bat script and run it from the shutdown_command. Check my post and my github repo.

Anyway, my problem is that although sysprep works it removes the virtualbox drivers installed by the guest additions.