Solved

Application to end processes automatically

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

I've always wanted to allow a user to have a printer no matter where they login. The steps below will show you how to achieve just that. In this Article I'll show how to deploy printers automatically with group policy and then using security fil…
A quick step-by-step overview of installing and configuring Carbonite Server Backup.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

919 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

13 Experts available now in Live!

Get 1:1 Help Now