Solved

Application to end processes automatically

Posted on 2008-10-08
2
213 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Organizations create, modify, and maintain huge amounts of data to help their businesses earn money and generally function.  Typically every network user within an organization has a bit of disk space to store in process items and personal files.   …
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

708 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now