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
  • 相关阅读:
    [NOI2010] 能量采集 (数学)
    mysql双主操作记录
    linux查看版本
    netty
    idea修改文件,target目录对应的文件消失
    oracle11g的分区(range、list)索引测试
    There is a cycle in the hierarchy解决办法
    git学习转廖雪峰
    解决SVN Cleanup错误: Failed to run the WC DB work queue associated with
    nginx之 proxy_pass
  • 原文地址:https://www.cnblogs.com/jevan/p/1967734.html
Copyright © 2011-2022 走看看