Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to switch or change the WMI IE Agent

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of "how to switch or change WMI IE agent". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "how to switch or change WMI IE agent" can help you solve the problem.

Just save the following code as vbs

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 agents you get in a text file (IP.txt) in the format of one line at a time: 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 agents (Use WMI Change IE Proxy)

Function ChangeProxy (IP, Port)

'get the 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

This is the end of the content about "how to switch or change WMI IE agents". Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report