码迷,mamicode.com
首页 > 其他好文 > 详细

计算机信息统计.vbs

时间:2014-12-12 18:46:33      阅读:199      评论:0      收藏:0      [点我收藏+]

标签:style   blog   io   ar   color   os   sp   for   on   

temp=0
set wshshell=wscript.createobject("wscript.shell")
Set WshNetwork = WScript.Createobject("WScript.Network")
computername=WshNetwork.ComputerName
strComputer = "."
   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.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

 

计算机信息统计.vbs

标签:style   blog   io   ar   color   os   sp   for   on   

原文地址:http://www.cnblogs.com/tomcattd/p/4160151.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!