D
D
Dmitry Pravdin2019-04-04 23:36:18
VBScript
Dmitry Pravdin, 2019-04-04 23:36:18

How does this script work?

I found a vbs script on the Internet to reboot a 4g modem via telnet.
And at the end of the script there are these lines:

WScript.Sleep 3500
ProcessClose("cmd.exe")
ProcessClose("telnet.exe") 
Function ProcessClose(sProcName) 
strComputer = "." 
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 
Set colProcessList = objWMIService.ExecQuery("Select * from Win32_Process Where Name = '" & sProcName & "'") 
For Each objProcess in colProcessList 
objProcess.Terminate() 
Next 
End Function

Tell me, please, what do they mean and do I need to change something for my computer?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rPman, 2019-04-05
@rPman

At the end, using WMI , a process with the name in the sProcName variable is searched (using SQL karl!)
Why is the full path with the computer name strComputer indicated there, I don’t know, is it really necessary to look for others on the network?
Then processes with that name are killed

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question