Photo Gallery
Member List
Search
Calendars
FAQ
Ticket List
Log Out
Forums
Register
Login
My Profile
Inbox
Address Book
My Subscription
My Forums
process terminating script
Logged in as: Guest
arrSession:exec spGetSession 2,16,42306
Active Users: There are
0
members and
0
guests.
Users viewing this topic: none
Printable Version
All Forums
>>
[Scripting]
>>
Post a VBScript
>> process terminating script
Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page:
[1]
Login
Message
<< Older Topic
Newer Topic >>
process terminating script -
1/22/2007 4:38:29 AM
chong
Posts: 74
Score: 0
Joined: 12/20/2006
Status:
offline
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
Post #: 1
RE: process terminating script -
1/22/2007 4:44:51 AM
ebgreen
Posts: 5246
Score: 31
Joined: 7/12/2005
Status:
offline
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
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:
http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm
(in reply to
chong
)
Revisions: 1
|
Post #: 2
RE: process terminating script -
1/22/2007 4:49:39 AM
chong
Posts: 74
Score: 0
Joined: 12/20/2006
Status:
offline
sowwie
btw, kudos to ebgreen & dm_4ever!
(in reply to
ebgreen
)
Revisions: 1
|
Post #: 3
If you found our site useful please link to us
<a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>
.
All Forums
>>
[Scripting]
>>
Post a VBScript
>> process terminating script
Page:
[1]
Jump to:
Select a Forum
All Forums
----------------------
[Welcome]
- - Forum Rules
- - Test Posting Messages
- - New Member Area/Introduction
[Scripting]
- - WSH & Client Side VBScript
- - WSH & Client Side VBScript Tutorial
- - Post a VBScript
- - Windows PowerShell
- - ASP
- - ASP.NET
- - Windows Script Components
[General Forum]
- - Other Programming/Scripting Languages
- - Suggestions & Feedback
- - Off-Topic Lounge
New Messages
No New Messages
Hot Topic w/ New Messages
Hot Topic w/o New Messages
Locked w/ New Messages
Locked w/o New Messages
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
Forum Software ©
ASPPlayground.NET
Advanced Edition
2.5.5 ANSI