Hello,
I have been troubleshooting an intermittent application crash issue happened late at night at a certain time. I and would like to find out what server processes running when the application crashes.
I suspect the problem may relate to some process that interferes with the application at the application crash time. I set up a scheduled task to log all running process name and which userID running it.
I used to tasklist command that checks the server every 5 seconds for a duration of 1 hour. I also filter out only process name and userID field.
Below is contents of taskmonitor.cmd:
for /f "delims=/ tokens=1-3" %%a in ("%DATE:~4%") do (
set logname=F:\temp\tasklog-%%c-%%b-%%a
Echo Job started on %%c-%%b-%%a > %logname%.txt
)
for /l %%x in (1, 1, 720) do (
echo %time% >> %logname%.txt
for /f "tokens=1,8 delims=," %%F in ('tasklist /nh /v /fo csv') do @echo %%~F %%~G >> %logname%.txt
timeout /t 4
)