Zend certified PHP/Magento developer

Proper RunSynchronousCommand exit code to fail autounattend installation?

I’m using an autounattend.xml file to perform an unattended installation of Windows Server 2022.

In the specialize phase, I have a few Powershell scripts I want to run (defined in RunSynchronousCommand elements).

I need to make sure that if either one of these scripts happens to fail, the whole installation process is interrupted right away. I would have expected an uncaught exception would do just that but much to my surprise it doesn’t. It just goes through the next step.

How can I make sure that the Windows installation gets interrupted whenever a custom script of mine fails? Am I supposed to exit with some sort of special code?