A
abovetreeline
Hi,
How to make javascript terminate a win32_process?
vbscript will terminate a named process with the following code:
strcomputer = "."
Set objwmiservice = GetObject("winmgmts:" _
& "{impersonationlevel=impersonate}!\\"&strcomputer & "\root\cimv2")
Set colprocesslist = objwmiservice.execquery _
("SELECT * FROM Win32_Process WHERE Name = 'winword.exe'")
For Each objprocess In colprocesslist
objprocess.terminate()
next
Javascript: Here is my best attempt at translating the vbscript into
javascript, but javascript just closes with no error message without
killing the process.
strcomputer = "."
var objWMIService =
GetObject("winmgmts:{impersonationlevel=impersonate}!\\\\" +
strcomputer + "\\root\\cimv2");
var colitems = objWMIService.ExecQuery("SELECT * FROM Win32_Process
WHERE Name = 'winword.exe'");
var indexitems;
for (indexitems in colitems){
indexitems.Terminate();
}
Thanks for the help.
How to make javascript terminate a win32_process?
vbscript will terminate a named process with the following code:
strcomputer = "."
Set objwmiservice = GetObject("winmgmts:" _
& "{impersonationlevel=impersonate}!\\"&strcomputer & "\root\cimv2")
Set colprocesslist = objwmiservice.execquery _
("SELECT * FROM Win32_Process WHERE Name = 'winword.exe'")
For Each objprocess In colprocesslist
objprocess.terminate()
next
Javascript: Here is my best attempt at translating the vbscript into
javascript, but javascript just closes with no error message without
killing the process.
strcomputer = "."
var objWMIService =
GetObject("winmgmts:{impersonationlevel=impersonate}!\\\\" +
strcomputer + "\\root\\cimv2");
var colitems = objWMIService.ExecQuery("SELECT * FROM Win32_Process
WHERE Name = 'winword.exe'");
var indexitems;
for (indexitems in colitems){
indexitems.Terminate();
}
Thanks for the help.