VBS-配置ip&DNS
strComputer = "." '本机 Set objWMIService = GetObject("winm...
扫描右侧二维码阅读全文
23
2008/06

VBS-配置ip&DNS

strComputer = "." '本机 Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\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

Last modification:November 26th, 2018 at 04:16 pm
If you think my article is useful to you, please feel free to appreciate

Leave a Comment