zoukankan      html  css  js  c++  java
  • Win32_NetworkAdapterConfiguration

     1     strComputer = "."
     2     Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
     3     
     4 '    Set colNetAdapters = objWMIService.ExecQuery (_
     5 '        "Select * from Win32_NetworkAdapterConfiguration Where Index=8")
     6 '   Index=8,导致硬件更换后网卡序列号不对。
     7     Set colNetAdapters = objWMIService.ExecQuery (_
     8         "Select * from Win32_NetworkAdapterConfiguration where IPEnabled=True")
     9     
    10     strIPAddress = Array("192.168.188.109")
    11     strSubnetMask = Array("255.255.255.0")
    12     strGateway = Array("192.168.188.100")
    13     strGatewayMetric = Array(1)
    14 '    If colNetAdapters Is Nothing Then
    15 '        MsgBox "不能创建colNetAdapters对象。"
    16 '    End If 
    17     
    18     For Each objNetAdapter in colNetAdapters
    19 '        WScript.Echo objNetAdapter.Caption  'Atheros AR8131 PCI-E Gigabit Ethernet Controller
    20         '修改指定网卡的IP
    21         If Left(objNetAdapter.Description,Len("Atheros AR8131"))="Atheros AR8131" Then 
    22             errEnable = objNetAdapter.EnableStatic(strIPAddress, strSubnetMask)
    23             errGateways = objNetAdapter.SetGateways(strGateway, strGatewaymetric)
    24         End If 
    25     Next
    26     
    27 '    参考资料:
    28 '    http://social.msdn.microsoft.com/Forums/zh-CN/windowssdk/thread/466fa3b8-9179-4244-9b83-5f8ffc6825bc
    29 '    http://topic.csdn.net/u/20100720/17/08148f61-926a-4a94-8ebd-3edcde9a5c0a.html
  • 相关阅读:
    [ISSUE]SyntaxWarning: name 'xxx' is assigned to before global declaration
    memcached 安装
    gulp 初体验
    gitcafe 使用hexo搭建博客
    sulime-text 3 安装以及使用
    media queries 媒体查询使用
    css3之@font-face---再也不用被迫使用web安全字体了
    前端的一些疑问总结01
    bootstrap 笔记01
    自定义表单样式之checkbox和radio
  • 原文地址:https://www.cnblogs.com/jevan/p/1967734.html
Copyright © 2011-2022 走看看