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
时间: 2024-09-30 02:32:12