首页 > 代码库 > 计算机信息统计.vbs

计算机信息统计.vbs

temp=0set wshshell=wscript.createobject("wscript.shell")Set WshNetwork = WScript.Createobject("WScript.Network")computername=WshNetwork.ComputerNamestrComputer = "."   Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")   Set cpu = objWMIService.ExecQuery("SELECT * FROM Win32_Processor")   For Each objItem In cpu         cpu2="CPU(G): " & objItem.name         Version2= "Version: " & objItem.VersionNextset disk =objwmiservice.execQuery("select * from win32_diskdrive")for each item in disk    disk2= "HD: " &  item.model    size2="Size(GB):"& round(item.size/1000000000)nextSet colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PhysicalMemory")For Each objItem in colItemsa=objitem.capacity/1048576temp=temp+objitem.capacityn=n+1Nextmemory=temp/1048576if n=1 thenmemory2= "Memory: " & n & "*" &a&"M"elsememory2= "Memory: " & n & "*" &a&"M"&" Total:"&memory&"M"end ifSet 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 NextSET 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,objAddressSet 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       NextNextfs.close

 

计算机信息统计.vbs