Many wscript processes

Maxz 1 Reputation point
2021-07-15T13:18:53.973+00:00

Hi, I have been running a vbscript that pipe the tasklist into a file and I will check whether the process wscript.exe running under userA is there by go thru each line and +1 if it matched.

The purpose is to check if there wscript under UserA exceeds the threshold(exceeds 3)

I have scheduled the job under windows scheduler with a interval of 10 mins for this new monitoring script.

I have 2 other scripts for other monitoring of files in certain folders running as well that I have scheduled and been running like for a year.

The new script has been running fine for the past few weeks but then just a few days back, I received email alert trigger by the new script where the tasklist has over 300+ of the wscripte.exe running under userA.

I went into the server and from task manager, indeed I do see many many wscript.exe under userA.

I have to manually kill those processes and so far it looks ok.

Firstly, I do not not which of the 3 jobs is causing the spike in wscript.exe and anyone is able to advise the cause why there can be so many such processes ?

Many tks

Regards
Maxz

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,896 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Michael Taylor 54,316 Reputation points
    2021-07-15T13:40:41.763+00:00

    While Windows doesn't put much emphasis on process relationships it does track if a child process has a parent. Use Process Explorer to view the process tree and see which of your scheduled tasks is creating all the child processes. If it is a single task then you just need to debug that one.

    As to the cause the most common case is your parent process (the scheduled task) isn't properly cleaning up the script process. Since you didn't post that code we cannot guess what you're doing wrong. If it were .NET then I'd say you aren't closing the process handle. Alternatively perhaps the script process is causing an error and your app isn't handling that properly.

    Yet another possible cause would be if the script is displaying some sort of prompt (either in error cases or running normally). In this case the process would stall waiting for user input that will never occur. If you have this occurring on a machine with Visual Studio installed then you can attach the debugger to the process and see where it is stuck at.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.