#include
#include
#NoTrayIcon
$ip = @IPAddress1
$result = StringTrimLeft($ip,10)
For $i=1 To 40 ;IP地址为1-40的机器
If $i = $result Then
; MsgBox(0, "bbb", $result)
Dim $SetDns[2],$SetGateway[1]
$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$objWMIService = ObjGet("winmgmts:\\.\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = TRUE", "WQL", _
$wbemFlagReturnImmediately + $wbemFlagForwardOnly)
$colComputers = $objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
If IsObj($colItems) Then
For $objNetAdapter in $colItems
$SetGateway[0] = "192.168.1.254"
$SetDns[0] = "221.228.255.1"
$SetDns[1] = "192.168.1.254"
$objNetAdapter.SetGateways($SetGateway)
$objNetAdapter.SetDNSServerSearchOrder($SetDns)
Next
EndIf
EndIf
Next
用开机通道运行后,效果如图:
客户机经常会时通时断,QQ一会上线,一会掉,感觉很不稳定,
高手帮我看看代码有没有问题!!!
多谢了! |