vbs-计算机硬件信息查看器-源码-.exe程序-可直接使用复制使用
vbs-计算机硬件信息查看器-源码-可直接使用复制使用
成都创新互联公司长期为超过千家客户提供的网站建设服务,团队从业经验10年,关注不同地域、不同群体,并针对不同对象提供差异化的产品和服务;打造开放共赢平台,与合作伙伴共同营造健康的互联网生态环境。为哈尔滨企业提供专业的成都做网站、成都网站设计,哈尔滨网站改版等技术服务。拥有10多年丰富建站经验和众多成功案例,为您定制开发。
#----------------------------------------------------------------------------------------以下为源代码
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
#----------------------------------------------------------------------------------------以上为源代码
网页标题:vbs-计算机硬件信息查看器-源码-.exe程序-可直接使用复制使用
文章源于:http://azwzsj.com/article/igjjsj.html