Board logo

标题: [问题求助] vbs 枚举网卡在域内做开机脚本 怎么导出到txt或者excel [打印本页]

作者: rp722    时间: 2013-9-29 16:31     标题: vbs 枚举网卡在域内做开机脚本 怎么导出到txt或者excel

小弟刚学习vbs入门,下面是我写的枚举网卡的代码 , 结果需要统计域内所有机器的网卡信息 到一张表上,需要用什么语句实现?
On Error Resume Next
strComputer = "."
Set WSHNetwork = WScript.CreateObject("WScript.Network")
ComputerName = WSHNetwork.ComputerName
Set FSO = CreateObject("Scripting.FileSystemObject")
Set TempFile = FSO.CreateTextFile(TempFiles)
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set colAdapters = objWMIService.ExecQuery _
            ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
    n = 0
    For Each objAdapter In colAdapters
    for each Objaddress in objAdapter.IPaddress
        n = n + 1  
        a = WSHNetwork.ComputerName   
        b= b  & objaddress
        c = c  & objAdapter.Description
        d = d  & objAdapter.MACAddress
    Next
next




欢迎光临 批处理之家 (http://bathome.net./) Powered by Discuz! 7.2