Question Locked

KILLING Remote process using wmi script

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

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

3 replies

by Member 25348569

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.

This discussion is closed to new replies.