0

I have written a PowerShell script to launch few webjobs in my local machine. My script is working fine and is launching each webjob in a new console window as expected. However, the issue I am facing is that if there is some problem with the webjob, the errors are displayed in the console window of that respective webjob. But before I can even read what it is, the window closes automatically.

Can anybody please suggest a fix for this where the window for the webjob doesn't exit when it has errors?

Currently, I am using this statement to launch them up separately in new window and tried using -NoExit in the hope that it will not terminate the window :

Start-Process dotnet.exe -ArgumentList "-file .\ProjectName.exe" -NoExit
James Z
  • 12,209
  • 10
  • 24
  • 44
  • 1
    You need to trap errors in the webjob so that if one occurs, it pauses to prevent the job ending. – Scepticalist Jun 24 '21 at 10:10
  • You might find this documentation helpful: [Everything you wanted to know about exceptions](https://learn.microsoft.com/en-us/powershell/scripting/learn/deep-dives/everything-about-exceptions?view=powershell-5.1) – D-squared Jun 25 '21 at 04:03

0 Answers0