• 计算机信息统计.vbs


    temp=0
    set wshshell=wscript.createobject("wscript.shell")
    Set WshNetwork = WScript.Createobject("WScript.Network")
    computername=WshNetwork.ComputerName
    strComputer = "."
       Set objWMIService = GetObject("winmgmts:\" & strComputer & "
    ootCIMV2")
       Set cpu = objWMIService.ExecQuery("SELECT * FROM Win32_Processor")
       For Each objItem In cpu
             cpu2="CPU(G): " & objItem.name
             Version2= "Version: " & objItem.Version
    Next
    set disk =objwmiservice.execQuery("select * from win32_diskdrive")
    for each item in disk
        disk2= "HD: " &  item.model
        size2="Size(GB):"& round(item.size/1000000000)
    next
    Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PhysicalMemory")
    For Each objItem in colItems
    a=objitem.capacity/1048576
    temp=temp+objitem.capacity
    n=n+1
    Next
    memory=temp/1048576
    if n=1 then
    memory2= "Memory: " & n & "*" &a&"M"
    else
    memory2= "Memory: " & n & "*" &a&"M"&" Total:"&memory&"M"
    end if
    Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_VideoController")
       For Each objItem In colItems
          name= "Video: " & objItem.Name
          RAM ="Video_memory(MB): " & objItem.AdapterRAM/1048576
       Next
     Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem")
       For Each objItem In colItems
                    operatingsys ="OperatingSystem: " & objItem.Caption
                     SP ="SP: " & objItem.CSDVersion
     Next
     Set board =objwmiservice.execQuery("select * from win32_baseboard")
       for each item in board
       board2= "Mainboard: " & item.Product
     Next
    
    SET fso = createobject("scripting.filesystemobject")
    txtpath = "D:"&computername&".txt"
    set fs = fso.createtextfile(txtpath,true)
    fs.writeline("Computername:"+computername)
    fs.writeline(cpu2)
    fs.writeline(memory2)
    fs.write(disk2+"     ")
    fs.writeline(size2)
    fs.writeline(board2)
    fs.write(name)
    fs.writeline(ram)
    fs.writeline(operatingsys)
    fs.writeline(sp)
    
    
    
    Dim objWMIService,colItems,objItem,objAddress
    Set objWMIService = GetObject("winmgmts://" & "." & "/root/cimv2")
    Set colItems = objWMIService.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
    For Each objItem in colItems
     For Each objAddress in objItem.IPAddress
      If objAddress <> "" then
      
      fs.writeline(objAddress & ",MAC:" & objItem.MACAddress)
      End If  
      
      
     Next
    
    Next
    
    
    
    
    fs.close
  • 相关阅读:
    js实现base64转换
    使用maven命令终端构建一个web项目及发布该项目
    使用eclipse构建Maven项目及发布一个Maven项目
    Maven在Windows上的安装与配置
    centos7下安装配置redis3.0.4
    Centos7下完美安装并配置mysql5.6
    linux常用命令总结
    VMware下centos桥接模式静态ip配置
    解决centos7下tomcat启动正常,无法访问项目的问题
    centos7系统下安装配置jdk、tomcat教程
  • 原文地址:https://www.cnblogs.com/tomcattd/p/4160151.html
Copyright © 2020-2023  润新知