Code Script .co.uk

Home | Scripts | Tutorials | Disclaimer | Sitemap | Contact

   End Process
 

Vbscript / Processes And Services / End Process

End a process by name using WMI.


strProcess = "excel.exe"
strComputer = "."

Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\" & strComputer & " ootcimv2")

Set colProcessList = objWMIService.ExecQuery _
    ("SELECT * FROM Win32_Process WHERE Name = '" & strProcess & "'")
For Each objProcess in colProcessList
    objProcess.Terminate()
Next





Please note that a disclaimer applies to any code on this page.
 
   Actions
  Go Back
  Bookmark
  Print Page


   Menu
 
- Links
- Reference
- Script Editors
- Tutorials
- Vbscript
     - Active Directory
     - Exchange
     - Files And Folders
     - General
     - Ms Office
     - Operating System
     - Processes And Services
          - Computer Service Properties
          - End Process
          - Running Process Properties
          - Start Stop Service
     - Text Processing
     - User Interaction
     - Web Servers