Question

Locked

KILLING Remote process using wmi script

By abhiramhi ·
strComputer = "abc;def;ghi;jkl;mno"

strDomain = "WOrkgroup"
strUser = InputBox("Enter user name")
strPassword = InputBox("Enter password")


Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
For Each machine in strComputer
Set objWMIService = objSWbemLocator.ConnectServer(strComputer, _
"root\CIMV2", _
strUser, _
strPassword, _
"MS_409", _
"ntlmdomain:" + strDomain)
Set colProcessList = objWMIService.ExecQuery _
("SELECT * FROM Win32_Process WHERE Name = 'notepad.exe'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next
Next


The following script is not working to kill remote pcs


can u please help

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

First off

by neilb@uk In reply to KILLING Remote process us ...

strComputer isn't a collection. You need to split the line using the split function.

sArray = Split(strComputer, ";")
For each Machine in sArray

I wouldn't bother with the locale or domain in the connection parameters unless you're connecting outside your login domain. You only need user name and password if your account doesn't have the rights.

Collapse -

thanks

by abhiramhi In reply to First off
Back to Software Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums