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
  • 相关阅读:
    vue3 中的路由传参
    js还原底层简单的history路由
    js还原底层简单的hash路由
    使用proxy以及Reflect还原vue3中的shallowReadonly 与 readonly响应式的原理
    flex布局兼容浏览器处理
    使用proxy以及Reflect还原vue3中的shallowReactive与reactive响应式的原理
    TS学习笔记--其他(声明文件、内置对象)
    TS学习笔记--泛型
    TS学习笔记--函数
    springboot+mybatis-plus快速精简配置
  • 原文地址:https://www.cnblogs.com/jevan/p/1967734.html
Copyright © 2011-2022 走看看