Save the following code as a VBS
Copy Code code as follows:
If WScript.Arguments.Count = 0 Then
Geti =-1
Else
Geti = CInt (wscript.arguments (0))
End If
Call Yourcode ()
' Write your agent in a text file (IP.txt), one line: IP: Port
IPS = CreateObject ("Scripting.FileSystemObject"). OpenTextFile ("IP.txt", 1, True). ReadAll
IPS = Split (IPs, VBCRLF)
For ips_i = 0 to UBound (IPS)
If ips_i > Geti Then
Iptemp = Split (IPS (ips_i), ":")
Changeproxy iptemp (0), iptemp (1)
Set WshShell = CreateObject ("Wscript.Shell")
Wshshell.run ("cscript" & Wscript.scriptfullname & "" & Ips_i)
Wscript.Quit
End If
Next
Sub Yourcode ()
' Your code
End Sub
' Use WMI to switch IE proxy (using WMI change IE proxy)
Function Changeproxy (IP, Port)
' Get computer name
' Set onetwork = WScript.CreateObject (' wscript.network ')
' Computername=onetwork.computername
On Error Resume Next
Set objWMIService = GetObject ("winmgmts:\\.\root\cimv2")
Set Objshare = Objwmiservice.get ("win32_proxy.servername= ' ComputerName '")
Set Objinparam = Objshare.methods_ ("setproxysetting"). Inparameters.spawninstance_ ()
Objinparam.properties_. Item ("proxyportnumber") = Port
Objinparam.properties_. Item ("proxyserver") = IP
Set objoutparams = Objwmiservice.execmethod ("win32_proxy.servername= ' ComputerName '", "setproxysetting", Objinparam)
End Function