您好,登錄后才能下訂單哦!
vbs-計算機硬件信息查看器-源碼-可直接使用復制使用
#----------------------------------------------------------------------------------------以下為源代碼
msgbox " 正在加載本機配置信息,請按確認繼續! ", 40, "配置信息查詢" On Error Resume Next SerVerPath = "c:\硬件信息" '這里的保存路徑可以為UNC網絡路徑(\\path\) set wshshell=wscript.createobject("wscript.shell") '啟動WMI服務 wshshell.run ("%comspec% /c regsvr32 /s scrrun.dll"),0,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:\硬件信息 mkdir c:\硬件信息"),0,True '2,5-10行為獨自等待添加,15行中的.\硬件信息為上面變量中的路徑,請根據需要修改。 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 = "系統信息:" & OSInfo & Mid(CStr(objOSInfo.InstallDate),1,4) & "-" & _ Mid(CStr(objOSInfo.InstallDate),5,2) & "-" & _ Mid(CStr(objOSInfo.InstallDate),7,2) & "☆" Next Dim objBoards, objBoard, BoardInfo Set objBoards = objWMIService.execQuery("Select * From Win32_BaseBoard") For each objBoard In objBoards BoardInfo = Trim(objBoard.Product) & "," BoardInfo = "主板型號:" & 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型號:" & 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 = "內存容量:" & objMemorys.Count & "條,共" & arrMemory(0) & "M," & arrMemory(1) & "☆" Dim objDisks, objDisk, DiskInfo Set objDisks = objWMIService.execQuery("Select * From win32_diskdrive") For Each objDisk In objDisks DiskInfo = "硬盤容量:" & 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 = "顯卡型號:" & 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 = "網卡信息:" & 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 '輸出信息到文件 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 '以下信息由獨自等待根據上面的輸出改寫的,方便查看。 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, "配置信息查詢" Set ws = CreateObject("Wscript.Shell") ws.run "cmd /c rd /s /q c:\硬件信息",vbhide
#----------------------------------------------------------------------------------------以上為源代碼
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。