Have you tried using the $LASTEXITCODE variable? It will contain the exit code of the last .exe that was invoked.
- https://devblogs.microsoft.com/powershell/errorlevel-equivalent/
Have you tried using the $LASTEXITCODE variable? It will contain the exit code of the last .exe that was invoked.