Packer issue - Powershell script provisioner - VM Reboot

Hello all,
I have a stack overflow post which has not gained any traction yet

Basically packer throw an error and reverts / cleans up anytime I try running a powershell script provisioner, in which the script forces the vm to reboot.

I’ve read about issues with VMs rebooting, which wasn’t invoked by packer it’s self

I’ve tried adding in pause_after, Windows-restart provisioners, check_commands for the Pending_reboot registry keys…
Nothing seems to make packer reconnect after the vm reboots from my powershell script.

Any help would be greatly appreciated.

The stack over flow post has logs abs build scripts for more details

Thank you