| Subcribe via RSS

VBS-配置ip&DNS

6月 23rd, 2008 Posted in VBS < by John.Lv >
strComputer = "." '本机
Set objWMIService = GetObject("winmgmts:
\\" &amp; strComputer &amp; "\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
strIPAddress=Array("192.168.1.214")?????
'设置ip地址,多个用,分隔
strSubnetMask=Array("255.255.255.0")? '子网掩码
strGateway=Array("192.168.1.72")?????????
'网关
strDNS = Array("192.168.1.72","202.96.209.133")??? 'DNS,多个用,分隔
strGatewaymetric = Array(1)??
'跃点数
For Each objNetAdapter in colNetAdapters
????
errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)?? '? 配置ip,子网掩码
???? errGateways = objNetAdapter.SetGateways(strGateway, strGatewaymetric)?
'配置网关
????
errDNS = objNetAdapter.SetDNSServerSearchOrder(strDNS)?? ' 配置dns
Next
WScript.Quit
Tags: , ,

Leave a Reply