Automatic reboots using Powershell provisioner

I am using the Powershell provisioner on Windows 10. I use Chocolately to install software within the provisioner. Recently, I found some provisioners exiting early because of a reboot. It’s not entirely clear to me why they reboots are happening, but i’m assuming because an installer asks for it. It would be great if I could disable those reboots, but it would at least be good to detect/fail when this happens. Currently Packer just moves on to the next provisioner and then only later do I see that configuration steps were skipped. Any thoughts on how to handle this?

I guess one idea would be to write out a file at the end of each provisioner and then check for it at the start of the next…seems kinda hacky though.

or maybe i’m “doing it wrong”…should i have a bunch of inline provisioners rather than 1 big script?

Indeed I ended up separating each install into an inline provisioner. More verbose but otherwise worked well.