Use WMI change IE proxy)

Source: Internet
Author: User

Set the following Code And save it as vbs. Copy code The Code is as follows: if wscript. Arguments. Count = 0 then
Geti =-1
Else
Geti = CINT (wscript. Arguments (0 ))
End if

Call yourcode ()

'Write all the proxies you get into a file (ip.txt) in the format of 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 change IE proxy)

function changeproxy (IP, Port)
'obtain the computer name
'set onetwork = wscript. createobject ("wscript. network ")
'computername = onetwork. computername
on error resume next
set ob1_miservice = GetObject ("winmgmts :\\. \ Root \ cimv2 ")
set objshare = ob1_miservice. get ("win32_proxy.servername = 'computername'")
set objinparam = objshare. methods _ ("setproxysetting "). inparameters. spawninstance _ ()
objinparam. properties _. item ("proxyportnumber") = port
objinparam. properties _. item ("proxyserver") = IP
set objoutparams = ob1_miservice. execmethod ("win32_proxy.servername = 'computername'", "setproxysetting", objinparam)
end function

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.