Sub ProcessTerminate(Process) Const StrComputer = "." Set WshShell = CreateObject("WScript.Shell") Set ObjWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & StrComputer & "\root\cimv2") Set ProcessList = objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE Name = '" & Process & "'") For Each ObjProcess in ProcessList On Error Resume Next ObjProcess.Terminate Wscript.Echo "Process Terminated, ProcessId=" & ObjProcess.ProcessId & " (" & ObjProcess.Name & ")" Next End Sub ProcessTerminate "chrome.exe"
Showing posts with label Terminate. Show all posts
Showing posts with label Terminate. Show all posts
Friday, February 3, 2017
Windows - How to terminate process using VBScript
Subscribe to:
Posts (Atom)