Which is the correct syntax to read back the ExitCode from a powershell script?

If I am not mistaken you are spawning a second powershell from your runners powershell. The script error occurs inside the second powershell, but the powershell itself dos not fail to execute. So from the main shell there is no visible error.
What you actually want to do is to just call

- ./script.ps1

instead of

- powershell -File ./script.ps1