Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Application to end processes automatically

Posted on 2008-10-08
2
216 Views
Last Modified: 2012-05-07
Is there an applicatin that will automatically end a specific process when it starts running?

This would be used on a server 2003 R2 32-bit box.
0
Comment
Question by:itiadmin
2 Comments
 

Expert Comment

by:corstiaan_haaij
ID: 22672952
What kind of process you will kill automatically?
When it is a Windows process, there is possible a service.
0
 
LVL 38

Accepted Solution

by:
Shift-3 earned 500 total points
ID: 22672979
You could use a vbscript like the one below.


'Adapted from http://www.microsoft.com/technet/scriptcenter/resources/qanda/oct06/hey1004.mspx
arrProcesses = Array("freecell.exe","sol.exe","spider.exe","winmine.exe")
 
strComputer = "."
 
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
 
i = 0
 
Set colMonitoredProcesses = objWMIService. ExecNotificationQuery _        
    ("Select * From __InstanceCreationEvent Within 5 Where TargetInstance ISA 'Win32_Process'")
 
Do While i = 0
    Set objLatestProcess = colMonitoredProcesses.NextEvent
    strProcess = LCase(objLatestProcess.TargetInstance.Name)
 
    For Each strName in arrProcesses
        If strName = strProcess Then
            objLatestProcess.TargetInstance.Terminate
        End If
    Next
Loop

Open in new window

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Numerous times I have been asked this questions that what is it that makes my machine log on so slow, there have been cases where computers took 23 minute exactly after taking password and getting to the desktop. Interesting thing was the fact th…
Recently, I had the need to build a standalone system to run a point-of-sale system. I’m running this on a low-voltage Atom processor, so I wanted a light-weight operating system, but still needed Windows. I chose to use Microsoft Windows Server 200…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question