rothunter.blogg.se

Windows xp process monitor kill restart memory threshold
Windows xp process monitor kill restart memory threshold












  1. WINDOWS XP PROCESS MONITOR KILL RESTART MEMORY THRESHOLD HOW TO
  2. WINDOWS XP PROCESS MONITOR KILL RESTART MEMORY THRESHOLD CODE
  3. WINDOWS XP PROCESS MONITOR KILL RESTART MEMORY THRESHOLD WINDOWS

Private Declare Function CloseHandle Lib "kernel32" ( _ Private Const PROCESS_QUERY_INFORMATION = &H400&

WINDOWS XP PROCESS MONITOR KILL RESTART MEMORY THRESHOLD CODE

Paste this code into the Form: Option Explicit Add a multiline TextBox Text1 and a Timer Timer1 (which is used to poll the children for completion). To create the demo open a new VB6 Project with a Form. You could enter exit 1234 or somesuch to see this in action. This demo also reports back the exit code of each process that quits. See A Safer Alternative to TerminateProcess(). It is also written to kill any running children when it is terminated, and there are better alternatives to use in most cases. The example is coded to start and repeatedly restart 3 copies of the command shell (trivial sample child program). Ok, here is a super-stripped-down example of a program in VB6 to spawn and monitor programs. CreateProcess gives you the handle directly. The VB6 Shell() function returns a Process ID you can use to call OpenProcess with.

windows xp process monitor kill restart memory threshold

You don't need to go spelunking for processes just to get a handle to child processes that you spawn.

windows xp process monitor kill restart memory threshold windows xp process monitor kill restart memory threshold

WINDOWS XP PROCESS MONITOR KILL RESTART MEMORY THRESHOLD HOW TO

  • How To Enumerate Processes From VB 6 on Win 2003?.
  • bat file but wait until its done running before moving on?
  • Monitoring processes to see if they've crashed in vb6.
  • Here are some related questions although you probably already saw them when you searched this site before posting:
  • Another EnumProcesses/OpenProcess implementation.
  • Getting Process Information using PSAPI.
  • There was another question posted about this a while back with some example code.Īnother possible approach would be to use WMI ( some useful snippets to adapt).įinally, here are some tutorials that show you how to do it (I'd recommend trying it yourself first though :): There is also a fairly nice example on MSDN.Īnd of course, there is CreateProcess ( AllApi link) or ShellExecute ( AllApi) for spawning processes - the former gives you more control over the creation of the process, while the latter is a much simpler call.

    WINDOWS XP PROCESS MONITOR KILL RESTART MEMORY THRESHOLD WINDOWS

    To start interrogating Windows about a particular process ( another VB6 example). I'd start with looking at EnumProcesses ( VB6 example and declaration here) which can be used to gather information about all running processes. If the process cannot be restarted, log and email (emailing is up to you to sort out).There are numerous Windows API functions you can use to do this. Stop the process if the average is >90% and log the eventĪttempt to start the process again and log We monitor for usage >90% over a thirty second period Send-MailMessage # Could not restart process!! The splat is up to you Write-EventLog -LogName "Application" -Source $ProcessName -EventID 3004 -EntryType Information -Message "$ProcessName could not be restarted" -Category 1 Write-EventLog -LogName "Application" -Source $ProcessName -EventID 3003 -EntryType Information -Message "$ProcessName restarted" -Category 1 That will be outside the scope of this reply.

    windows xp process monitor kill restart memory threshold

    If usage greater than defined threshold/period - restart processĪfter you have the logic, you have to decide how to you want this script to run, scheduletask etc. So the script logic likely looks something like this in layman's terms: I suspect this is true otherwise it will constantly restart. You only want to restart the process if it consumes >90% CPU for a period of time and not a single instantaneous peak? There may be an assumption in the description, can you please verify?














    Windows xp process monitor kill restart memory threshold