chong
-
Total Posts
:
74
- Scores: 0
-
Reward points
:
0
- Joined: 12/20/2006
-
Status: offline
|
process terminating script
Monday, January 22, 2007 5:38 AM
( permalink)
Pretty handy script!
Option Explicit
Dim objWMIService, objProcess, colProcess, objShell
Dim strComputer, strProcessKill, intReturn
strComputer = "."
strProcessKill = "'IEXPLORE.EXE'" 'change this to reflect process you wish to terminate inclue ' '
Set objShell = CreateObject("Wscript.Shell")
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery ("Select * from Win32_Process Where Name = " & strProcessKill )
If colProcess.Count = 0 Then
objShell.Popup strProcessKill & " is not currently running!",0,"Process isn't running"", 0 + 64
WScript.Quit
else
intReturn = objShell.Popup("Windows will now terminate all " & strProcessKill&"'s " & VbNewLine & "Do you wish to continue?" ,0,"Windows Process Termination", 1 + 32 )
If intReturn = 2 Then
objShell.Popup strProcessKill & " not Terminated",0,"Process Not Terminated", 0 + 64
else
For Each objProcess in colProcess
objProcess.Terminate()
Next
objShell.Popup strProcessKill & " Terminated",0,"Process Terminated", 0 + 64
End If
End If
WScript.Quit
enjoy x
|
|
|
|
ebgreen
-
Total Posts
:
8227
- Scores: 98
-
Reward points
:
0
- Joined: 7/12/2005
-
Status: offline
|
RE: process terminating script
Monday, January 22, 2007 5:44 AM
( permalink)
Reposted with formatting: Option Explicit
Dim objWMIService, objProcess, colProcess, objShell
Dim strComputer, strProcessKill, intReturn
strComputer = "."
strProcessKill = "'IEXPLORE.EXE'" 'change this to reflect process you wish to terminate inclue ' '
Set objShell = CreateObject("Wscript.Shell")
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery ("Select * from Win32_Process Where Name = " & strProcessKill )
If colProcess.Count = 0 Then
objShell.Popup strProcessKill & " is not currently running!",0,"Process isn't running", 0 + 64
WScript.Quit
Else
intReturn = objShell.Popup("Windows will now terminate all " & strProcessKill&"'s " & VbNewLine & "Do you wish to continue?" ,0,"Windows Process Termination", 1 + 32 )
If intReturn = 2 Then
objShell.Popup strProcessKill & " not Terminated",0,"Process Not Terminated", 0 + 64
Else
For Each objProcess in colProcess
objProcess.Terminate()
Next
objShell.Popup strProcessKill & " Terminated",0,"Process Terminated", 0 + 64
End If
End If
WScript.Quit
|
|
|
|
chong
-
Total Posts
:
74
- Scores: 0
-
Reward points
:
0
- Joined: 12/20/2006
-
Status: offline
|
RE: process terminating script
Monday, January 22, 2007 5:49 AM
( permalink)
sowwie btw, kudos to ebgreen & dm_4ever!
|
|
|
|