I did some digging and it appears bootType is being incorrectly detected as legacy, so the script is formatting the drive as MBR. $env:firmware_type contains the correct value, EFI. I found that the boot type is determined using Confirm-SecureBootUEFI, interpreting a failure to run as legacy boot. This system does not support secure boot, causing Confirm-SecureBootUEFI to crash, although it does use UEFI. Is there a reason Confirm-SecureBootUEFI is used instead of $env:firmware_type for the boot type?