Vbs- computer hardware information viewer-source code-.exe program-can be used directly for replication
Vbs- computer hardware information viewer-source code-can be used directly for replication
#-here is the source code
Msgbox "loading native configuration information Click OK to continue, 40, "configuration Information query" On Error Resume Next SerVerPath = "c:\ hardware Information" 'where the save path can be the UNC network path (\\ path\) set wshshell=wscript.createobject ("wscript.shell")' to start the WMI service wshshell.run ("% comspec% / c regsvr32 / s scrrun.dll"), 0Ling True wshshell.run ("% comspec% / c sc config winmgmt start= auto"), 0 True wshshell.run ("% comspec% / c net start winmgmt"), 0 wshshell.run ("% comspec% / c if not exist c:\ hardware information mkdir c:\ hardware information"), 0gery True'2 5-10 behavior waiting to be added alone The.\ hardware information in line 15 is the path in the above variable, please modify it as needed. Dim objWMIService Set objWMIService = Getobject ("winmgmts:\\.\ root\ cimv2") Dim objOSInfos, objOSInfo, OSInfo, ComputerName, OSVer Set objOSInfos = objWMIService.execQuery ("Select * From win32_operatingsystem") For Each objOSInfo In objOSInfos OSInfo = objOSInfo.CSName & "," ComputerName = objOSInfo.CSName OSVer = objOSInfo.Version OSInfo = OSInfo & objOSInfo.Caption & "& objOSInfo.CSDVersion &", "OSInfo =" system Information: & OSInfo & Mid (CStr (objOSInfo.InstallDate)) 1Select 4) & "-" & _ Mid (CStr (objOSInfo.InstallDate), 5dag2) & "-" & _ Mid (CStr (objOSInfo.InstallDate), 7Power2) & "☆" Next Dim objBoards, objBoard, BoardInfo Set objBoards = objWMIService.execQuery ("Select * From Win32_BaseBoard") For each objBoard In objBoards BoardInfo = Trim (objBoard.Product) & " "BoardInfo =" Motherboard Model: & BoardInfo & Trim (objBoard.Manufacturer) & "☆" Next Dim objCPUs, objCPU, CPUInfo Set objCPUs = objWMIService.execQuery ("Select * From win32_processor") For each objCPU In objCPUs CPUInfo = Trim (objCPU.Name) & "," CPUInfo = CPUInfo & objCPU.ExtClock & "CPUInfo = CPUInfo & objCPU.L2CacheSize &", "CPUInfo =" CPU Model: & CPUInfo & objCPU.SocketDesignation & "☆" Next Dim objMemorys, objMemory MemoryInfo Set objMemorys = objWMIService.execQuery ("Select * From Win32_PhysicalMemory") Redim arrMemory (1) For Each objMemory In objMemorys arrMemory (0) = arrMemory (0) + objMemory.capacity/1048576 arrMemory (1) = arrMemory (1) & objMemory.Speed & "/" & objMemory.DeviceLocator & "" Next MemoryInfo = "memory capacity:" & objMemorys.Count & " Total & arrMemory (0) & "M," & arrMemory (1) & "☆" Dim objDisks, objDisk, DiskInfo Set objDisks = objWMIService.execQuery ("Select * From win32_diskdrive") For Each objDisk In objDisks DiskInfo = "hard disk capacity:" & Trim (objDisk.Model) & "☆" Exit For Next Dim objVideos, objVideo VideoInfo Set objVideos = objWMIService.execQuery ("Select * From win32_videocontroller") For Each objVideo In objVideos If Not IsNull (objVideo.VideoModeDescription) Then VideoInfo = Trim (objVideo.Description) VideoInfo = "graphics card model:" & VideoInfo & "(" & objVideo.AdapterRAM/1048576 & "M) ☆" End If Next Dim objNetworks, objNetwork, objNetworks_2, objNetwork_2 NetWorkInfo NetWorkInfo = "" Set objNetworks = objWMIService.execQuery ("Select * From Win32_NetworkAdapter") Set objNetworks_2 = objWMIService.execQuery ("Select * From Win32_NetworkAdapterConfiguration") For Each objNetwork In objNetworks If objNetwork.Manufacturer "Microsoft" And Not Isnull (objNetwork.MACAddress) Then For Each objNetwork_2 In objNetworks_2 If objNetwork_2.Index = objNetwork.Index Then NetWorkInfo = "Network Card Information:" & objNetwork.Description & " "& objNetwork_2.IPAddress (0) & _ Space (17-Len (objNetwork_2.IPAddress (0) & _ Replace (objNetwork_2.MACAddress,": ","-") &" ☆ "Exit For End If Next If NetWorkInfo"Then Exit For End If Next 'outputs information to the file Dim FSO OutFile Set FSO = WScript.Createobject ("Scripting.Filesystemobject") SerVerPath = FSO.GetAbsolutePathName (SerVerPath) Set OutFile = FSO.CreateTextFile (SerVerPath & "\" & ComputerName & ".txt", True) 'OutFile.Writeline OSInfo & BoardInfo & CPUInfo & MemoryInfo & DiskInfo & VideoInfo & NetWorkInfo' the following information is waiting alone to be rewritten according to the above output It's easy to see. OutFile.Writeline OSInfo + vbCrLf OutFile.Writeline BoardInfo + vbCrLf OutFile.Writeline CPUInfo + vbCrLf OutFile.Writeline MemoryInfo + vbCrLf OutFile.Writeline DiskInfo + vbCrLf OutFile.Writeline VideoInfo + vbCrLf OutFile.Writeline NetWorkInfo + vbCrLf msgbox "& OSInfo &" & vbNewLine& "& BoardInfo &" & vbNewLine& "& CPUInfo &" & vbNewLine& "& MemoryInfo &" & vbNewLine& "& DiskInfo &" & vbNewLine& "& VideoInfo &" "& vbNewLine&" & NetWorkInfo & "" 40, "configuration Information query" Set ws = CreateObject ("Wscript.Shell") ws.run "cmd / c rd / s / Q c:\ hardware Information", vbhide
#-above is the source code