0

I'm very new in PowerShell scripting, I'm not looking for someone to solve my problem but a little help.

I have an app that crashes and would like to run a bat file when crash. We have a log file that log certain errors and I want to trigger an execution of a bat file when an error occurs. The log file logs an error like "An error occurred while..." then I want to trigger an action with powershell.

Hope you guys can guide me.

mklement0
  • 382,024
  • 64
  • 607
  • 775
  • You can use `ProcDump` - command-line utility whose primary purpose is monitoring an application for CPU spikes and generating crash dumps during a spike that an administrator or developer can use to determine the cause of the spike. ProcDump also includes hung window monitoring (using the same definition of a window hang that Windows and Task Manager use), unhandled exception monitoring and can generate dumps based on the values of system performance counters. It also can serve as a general process dump utility that you can embed in other scripts. – another victim of the mouse May 05 '22 at 02:44
  • Thanks for the help, I really appreciate it, but the app I manage crashes when a transaction has an exception instead of CPU or memory usage. I know that the application needs to handle exceptions. I am looking to start the java application with a bat file when the error occurs. – Nestor Alfonso Alanis Soto May 05 '22 at 03:04

1 Answers1

0

You can use procdump to accomplish this.

C:\>procdump -h hang.exe hungwindow.dmp

Write a mini dump of a process named
'outlook' when total system CPU usage
exceeds 20% for 10 seconds: