配置静态 IP 地址
2005-07-09 10:00
746 查看
描述
将计算机的 IP 地址设置为 192.168.1.141,并将 IP 网关设置为 192.168.1.100。
脚本代码
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
strIPAddress = Array("192.168.1.141")
strSubnetMask = Array("255.255.255.0")
strGateway = Array("192.168.1.100")
strGatewayMetric = Array(1)
For Each objNetAdapter in colNetAdapters
errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
errGateways = objNetAdapter.SetGateways(strGateway, strGatewaymetric)
If errEnable = 0 Then
WScript.Echo "The IP address has been changed."
Else
WScript.Echo "The IP address could not be changed."
End If
Next
将计算机的 IP 地址设置为 192.168.1.141,并将 IP 网关设置为 192.168.1.100。
脚本代码
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colNetAdapters = objWMIService.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
strIPAddress = Array("192.168.1.141")
strSubnetMask = Array("255.255.255.0")
strGateway = Array("192.168.1.100")
strGatewayMetric = Array(1)
For Each objNetAdapter in colNetAdapters
errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
errGateways = objNetAdapter.SetGateways(strGateway, strGatewaymetric)
If errEnable = 0 Then
WScript.Echo "The IP address has been changed."
Else
WScript.Echo "The IP address could not be changed."
End If
Next
相关文章推荐
- Azure 中国篇之网络服务—(4)为 Azure虚拟机配置静态内部 IP 地址 (DIP)
- 用vbs实现配置静态 IP 地址
- Microsoft Azure系列之十 为Azure虚拟机配置静态内部 IP 地址 (DIP)
- cisco配置IP 网关 辅助地址 静态 默认 浮动路由
- 修改Android5.1源码,配置以太网设置默认为静态ip
- Cisco 静态绑定IP和MAC地址
- centos配置静态ip
- [置顶] ubuntu14.04 图形化配置 静态IP
- (总结)Ubuntu Server 12.04 静态IP简洁配置
- 在 Windows Azure 网站中配置动态 IP 地址限制
- 在配置静态IP的时候遇到 :bringing up interface eth0 : error unknown connection
- ubuntu14.10配置静态IP中所遇到的DNS问题
- linux (debian) 配置静态ip
- 虚拟机ubuntu 14 配置静态ip及配置后无法链接外网问题
- Windows Azure 设置虚拟机静态外网IP地址
- Linux系统配置静态IP的方式
- 虚拟机配置静态 IP 以后无法连接的解决办法
- Linux 配置静态IP
- Ubuntu 14.04 配置静态IP
- linux_下IP、网关、DNS地址配置