Jump to content
Sign in to follow this  
steve8tch

ProcessExists / ProcessClose

Recommended Posts

steve8tch

I have put this question here rather than in the help and support - I know how to use this function.

I have noticed an inconsistancy I thought I would bring up.

I have a script running on 1000+ headless computers that monitors some application and support processes. Most done through WMI. One of the thing I monitor is CPU usage of dfrgntfs. We want the defragger to run - but we also want it to stop. On some PCs - the dfgntfs.exe - goes into a 100% cpu loop and I would like to kill it off.

Now for 75% of these ProcessClose works and for the others it does not work.

Upon further investigation it turns out that ProcessExists() cannot see dfrgntfs.exe. WMI can see it, pslist can see it but Autoit cannot.

I am assuming that unless AutoIt can see the "exe" then AutoIt cannot close the "exe".

Has anyone any thoughts..

Share this post


Link to post
Share on other sites
steve8tch

An update...

The reason for wanting this functionality is to be able to shut down process than seem out of control( eg drfgntfs.exe). I have now changed the code to use tasklist.exe and taskkill.exe.

This seems to work OK.

I still do not know why ProcessExsits() and ProcessClose() cannot see these processes. :mellow:

Share this post


Link to post
Share on other sites
Valik

You have left out lots of information.

  • What OS does it fail on?
  • Does ProcessExists()/ProcessClose() work at all on these machines where it fails in your specific case?
  • What user is the defragger running as?
  • What user is the script running as?
  • What type of account is the script running as?

Share this post


Link to post
Share on other sites
steve8tch

Cheers Valik - thanks for the reply.

WinXP SP2

Script running as service using a local admin account. (using srvany.exe)

MS defrag (dfrgntfs) running a scheduled task under SYSTEM account.

Does ProcessExists()/ProcessClose() work at all on these machines where it fails in your specific case?

This is the interesting question.

Yes - I modified script to write out the list of running processes returned in ProcessList(). When ProcessClose() failed - dfrgntfs.exe was not listed in the list of processes even though task manager shows the process as running.

I did not try ProcessClose() on another process on the systems that failed.

When I closed the process down using task manager and then restarted the defragger task and then initiated the ProcessClose() - it worked 100% of the time.

Some other background.

In tests - when defrag task started and CPU = 0 -> 50+ % (Normal usage). ProcessExists()/ProcessClose() will work 100% of time

Under normal use - if CPU = 0 -> 50+ % ProcessExists()/ProcessClose() will work 100% of time

But - when I find CPU ~ 98% (and the CPU running at this level for several hours / days) it suggests that the process is out of control.

In these cases ProcessExists()/ProcessClose() will work 75% of time. (Based on 30 such systems I found in this state)

The other interesting fact - most of these are dual core - some and Pentium 4 with Hyperthreading - so although some tools show CPU as 98%, in fact they are using 98% of one core.

The PCs where ProcessExists()/ProcessClose() failed were mainly dual core.

Share this post


Link to post
Share on other sites
Valik

i think processes must run as the same user to be able to view/close other processes.

You think wrong. Processes can be closed even if they are under a different user account as long as the user context trying to close has the right privileges. In short, if anything else can do it, AutoIt can do it (normally).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×