13 Replies Latest reply on Feb 13, 2019 3:44 AM by Markus Kruse

    NSH Type 2 - Execute PowerShell script and return exit code

    Vadlla Saikiran



      I'm facing a challenge to retrieve exit status from a powershell script execution through NSH Script.

      BSA Version: 8.9.2


      Here is what i'm doing:


      NSH Script type: 2 (%h)



      nexec -i -l "$TARGET" cmd /c "echo . | powershell -version x.x -inputformat none -ExecutionPolicy Bypass D:\\Temp\\test.ps1"



      My goal is get exit code of test.ps1 (not 0 or 1 from $?)


      Any suggestions are highly appreciated!!