Sponsored Links

Login Form






Lost Password?

Syndicate

Home
Process Monitor And Killer PDF Print E-mail
User Rating: / 0
PoorBest 
Written by Cheyenne Harden   
It's me again... Ho,Hum... I have a user who likes to run games on his computer instead of doing his work.
I found a couple of scripts online and joined them together. This script will monitor a specified computer
and if a defined process starts, the script will kill it.
You could also run this as a logon script by replacing
This:  strComputer = InputBox("Enter the name of the target computer here!")
With this: strComputer = "."

 

----------COPY EVERYTHING BELOW THIS LINE----------

'This script will kill a defined process in an Array.
'Created by Chey Harden October 6, 2006

arrProcesses = Array("freecell.exe","sol.exe","spider.exe","winmine.exe") 'Enter Processes here in quotes, seperated by a comma!

Dim objWMIService, objProcess, colProcess, objWMIService1
Dim strComputer, strProcessKill
strComputer = InputBox("Enter the name of the target computer here!")


Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & 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
            Wscript.Echo strName & " has started." & "'"

  Set objWMIService1 = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
  Set colProcessList = objWMIService1.ExecQuery _
      ("Select * from Win32_Process Where Name = '" & strName & "'")
  For Each objProcess in colProcessList
      objProcess.Terminate()
  Next

   
        End If
    Next
Loop

 

 

----------COPY EVERYTHING ABOVE THIS LINE----------

 

PLEASE MAKE SURE NO WORD WRAPPING IS HAPPENING IN YOUR SCRIPT!!!

To make this script work you will need two things!


1. You will need to have Admin provlidges on the target computer.
2. Secondly, you will need the name of the process or processes you want to kill.
Place the process names like this: arrProcesses = Array("freecell.exe","sol.exe","spider.exe","winmine.exe")

NOTE: Version 5.6 of the Windows Scripting Host must be installed to run this script!!!

This information is provided "AS IS" with no warranties expressed or implied.

Comments
Add NewSearch
Write comment
Name:
Email:
 
Website:
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
 
 
Security Image
Please input the anti-spam code that you can read in the image.

Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved.

 
Tag it:
Delicious
Furl it!
Spurl
digg
YahooMyWeb
< Prev   Next >
 

Google Search

Google