process terminating script

Author Message
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)
0
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
 
#1
    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)
    0
    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
     
    #2
      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)
      0
      sowwie
       
      btw, kudos to ebgreen & dm_4ever!
       
       
       
      #3

        Online Bookmarks Sharing: Share/Bookmark

        Jump to:

        Current active users

        There are 0 members and 1 guests.

        Icon Legend and Permission

        • 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
        • Read Message
        • Post New Thread
        • Reply to message
        • Post New Poll
        • Submit Vote
        • Post reward post
        • Delete my own posts
        • Delete my own threads
        • Rate post

        2000-2012 ASPPlayground.NET Forum Version 3.9