1)批处理脚本:HardwareInfoCollector.bat
调用VBScript脚本HardwareInfoCollector.vbs
,并将结果打印到文件Result.txt
HardwareInfoCollector.bat
代码:
@if exist Result.txt (del Result.txt)
@cscript HardwareInfoCollector.vbs >> Result.txt
@echo "结果已打印到 Result.txt"
@pause
2)VBScript脚本:HardwareInfoCollector.vbs
'On Error Resume Next
If WScript.Arguments.Count >= 1 Then
Select Case WScript.Arguments(0)
Case "-e", "--execute"
Case "-v", "--version"
WScript.Echo "程序版本:1.0.0.0"
WScript.Echo "作者标识:linuxbaodian.com"
WScript.Echo "作者主页:https://www.linuxbaodian.com/"
WScript.Echo
WScript.Quit(0)
Case "-h", "--help"
WScript.Echo "进行检查:HardwareInfoCollector.vbs [-e|--execute]"
WScript.Echo "查看帮助:HardwareInfoCollector.vbs [-h|--help]"
WScript.Echo "查看版本:HardwareInfoCollector.vbs [-v|--version]"
WScript.Echo
WScript.Quit(0)
End Select
End If
Set WMI = GetObject("Winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Dim i, j, k
StartTime = Now
SystemOverview
ProcessorInfo
BaseBoardInfo
MemoryInfo
DiskInfo
GraphicsInfo
DisplayInfo
SoundCardInfo
NetworkCardInfo
KeyBoardInfo
BatteryInfo
PointingDeviceInfo
CDROMDriveInfo
OtherHardware
FinishTime = Now
RunStats
WScript.Echo
'打印标题
Sub SetTitle(TitleName)
Dim Title : Title = TitleName
For i = 0 To 9
Title = "-" & Title & "-"
Next
WScript.Echo Title
End Sub
'系统概览
'参考:https://msdn.microsoft.com/en-us/library/aa394102%28VS.85%29.aspx
Sub SystemOverview
SetTitle "1.系统概览"
Set Computers = WMI.ExecQuery("Select * from Win32_ComputerSystem")
For Each Computer in Computers
Wscript.Echo "生产厂家:" & Computer.Manufacturer
Wscript.Echo "当前用户:" & Computer.UserName
Next
WScript.Echo
End Sub
'处理器信息
'参考:https://msdn.microsoft.com/en-us/library/aa394373%28VS.85%29.aspx
Sub ProcessorInfo
SetTitle "2.处理器信息"
Set CPUs = WMI.InstancesOf("Win32_Processor")
For Each CPU In CPUs
WScript.Echo "设备名称: " & CPU.Name
WScript.Echo "设备描述: " & CPU.Description
WScript.Echo "设备说明: " & CPU.Caption
WScript.Echo "处理器标识: " & CPU.ProcessorId
Dim ProcessorType : ProcessorType = "处理器类型:"
Select Case CPU.ProcessorType
Case 1 : ProcessorType = ProcessorType & "Other"
Case 2 : ProcessorType = ProcessorType & "Unknown"
Case 3 : ProcessorType = ProcessorType & "Central Processor"
Case 4 : ProcessorType = ProcessorType & "Math Processor"
Case 5 : ProcessorType = ProcessorType & "DSP Processor"
Case 6 : ProcessorType = ProcessorType & "Video Processor"
Case Else : ProcessorType = ProcessorType & "[Type]" & CPU.ProcessorType
End Select
WScript.Echo ProcessorType
WScript.Echo "处理器版本: " & CPU.Version
'WScript.Echo "唯一标识: " & CPU.UniqueId
WScript.Echo "设备标识: " & CPU.DeviceID
Dim Family : Family = "处理器家族:"
Select Case CPU.Family
Case 1 : Family = Family & "Other"
Case 2 : Family = Family & "Unknown"
Case 3 : Family = Family & "8086"
Case 4 : Family = Family & "80286"
Case 5 : Family = Family & "Intel386(TM) Processor"
Case 6 : Family = Family & "Intel486(TM) Processor"
Case 7 : Family = Family & "8087"
Case 8 : Family = Family & "80287"
Case 9 : Family = Family & "80387"
Case 10 : Family = Family & "80487"
Case 11 : Family = Family & "Pentium Brand"
Case 12 : Family = Family & "Pentium Pro"
Case 13 : Family = Family & "Pentium II"
Case 14 : Family = Family & "Pentium Processor with MMX(TM) Technology"
Case 15 : Family = Family & "Celeron(TM)"
Case 16 : Family = Family & "Pentium II Xeon(TM)"
Case 17 : Family = Family & "Pentium III"
Case 18 : Family = Family & "M1 Family"
Case 19 : Family = Family & "M2 Family"
Case 24 : Family = Family & "AMD Duron(TM) Processor Family"
Case 25 : Family = Family & "K5 Family"
Case 26 : Family = Family & "K6 Family"
Case 27 : Family = Family & "K6-2"
Case 28 : Family = Family & "K6-3"
Case 29 : Family = Family & "AMD Athlon(TM) Processor Family"
Case 30 : Family = Family & "AMD2900 Family"
Case 31 : Family = Family & "K6-2+"
Case 32 : Family = Family & "Power PC Family"
Case 33 : Family = Family & "Power PC 601"
Case 34 : Family = Family & "Power PC 603"
Case 35 : Family = Family & "Power PC 603+"
Case 36 : Family = Family & "Power PC 604"
Case 37 : Family = Family & "Power PC 620"
Case 38 : Family = Family & "Power PC X704"
Case 39 : Family = Family & "Power PC 750"
Case 48 : Family = Family & "Alpha Family"
Case 49 : Family = Family & "Alpha 21064"
Case 50 : Family = Family & "Alpha 21066"
Case 51 : Family = Family & "Alpha 21164"
Case 52 : Family = Family & "Alpha 21164PC"
Case 53 : Family = Family & "Alpha 21164a"
Case 54 : Family = Family & "Alpha 21264"
Case 55 : Family = Family & "Alpha 21364"
Case 64 : Family = Family & "MIPS Family"
Case 65 : Family = Family & "MIPS R4000"
Case 66 : Family = Family & "MIPS R4200"
Case 67 : Family = Family & "MIPS R4400"
Case 68 : Family = Family & "MIPS R4600"
Case 69 : Family = Family & "MIPS R10000"
Case 80 : Family = Family & "SPARC Family"
Case 81 : Family = Family & "SuperSPARC"
Case 82 : Family = Family & "microSPARC II"
Case 83 : Family = Family & "microSPARC IIep"
Case 84 : Family = Family & "UltraSPARC"
Case 85 : Family = Family & "UltraSPARC II"
Case 86 : Family = Family & "UltraSPARC IIi"
Case 87 : Family = Family & "UltraSPARC III"
Case 88 : Family = Family & "UltraSPARC IIIi"
Case 96 : Family = Family & "68040"
Case 97 : Family = Family & "68xxx Family"
Case 98 : Family = Family & "68000"
Case 99 : Family = Family & "68010"
Case 100 : Family = Family & "68020"
Case 101 : Family = Family & "68030"
Case 112 : Family = Family & "Hobbit Family"
Case 120 : Family = Family & "Crusoe(TM) TM5000 Family"
Case 121 : Family = Family & "Crusoe(TM) TM3000 Family"
Case 122 : Family = Family & "Efficeon(TM) TM8000 Family"
Case 128 : Family = Family & "Weitek"
Case 130 : Family = Family & "Itanium(TM) Processor"
Case 131 : Family = Family & "AMD Athlon(TM) 64 Processor Family"
Case 132 : Family = Family & "AMD Opteron(TM) Processor Family"
Case 144 : Family = Family & "PA-RISC Family"
Case 145 : Family = Family & "PA-RISC 8500"
Case 146 : Family = Family & "PA-RISC 8000"
Case 147 : Family = Family & "PA-RISC 7300LC"
Case 148 : Family = Family & "PA-RISC 7200"
Case 149 : Family = Family & "PA-RISC 7100LC"
Case 150 : Family = Family & "PA-RISC 7100"
Case 160 : Family = Family & "V30 Family"
Case 176 : Family = Family & "Pentium III Xeon(TM) Processor"
Case 177 : Family = Family & "Pentium III Processor with Intel SpeedStep(TM) Technology"
Case 178 : Family = Family & "Pentium 4"
Case 179 : Family = Family & "Intel Xeon(TM)"
Case 180 : Family = Family & "AS400 Family"
Case 181 : Family = Family & "Intel Xeon(TM) Processor MP"
Case 182 : Family = Family & "AMD Athlon(TM) XP Family"
Case 183 : Family = Family & "AMD Athlon(TM) MP Family"
Case 184 : Family = Family & "Intel Itanium 2"
Case 185 : Family = Family & "Intel Pentium M Processor"
Case 190 : Family = Family & "K7"
Case 198 : Family = Family & "Intel Core(TM) i7-2760QM"
Case 200 : Family = Family & "IBM390 Family"
Case 201 : Family = Family & "G4"
Case 202 : Family = Family & "G5"
Case 203 : Family = Family & "G6"
Case 204 : Family = Family & "z/Architecture Base"
Case 250 : Family = Family & "i860"
Case 251 : Family = Family & "i960"
Case 260 : Family = Family & "SH-3"
Case 261 : Family = Family & "SH-4"
Case 280 : Family = Family & "ARM"
Case 281 : Family = Family & "StrongARM"
Case 300 : Family = Family & "6x86"
Case 301 : Family = Family & "MediaGX"
Case 302 : Family = Family & "MII"
Case 320 : Family = Family & "WinChip"
Case 350 : Family = Family & "DSP"
Case 500 : Family = Family & "Video Processor"
Case Else : Family = Family & "[Family Type] " & CPU.Family
End Select
WScript.Echo Family
Dim Architecture : Architecture = "处理器架构:"
Select Case CPU.Architecture
Case 0 : Architecture = Architecture & "x86"
Case 1 : Architecture = Architecture & "MIPS"
Case 2 : Architecture = Architecture & "Alpha"
Case 3 : Architecture = Architecture & "PowerPC"
Case 5 : Architecture = Architecture & "ARM"
Case 6 : Architecture = Architecture & "Itanium-based systems"
Case 9 : Architecture = Architecture & "x64"
Case Else : Architecture = Architecture & "[Architecture] " & CPU.Architecture
End Select
WScript.Echo Architecture
WScript.Echo "-"
WScript.Echo "内核数量: " & CPU.NumberOfCores
WScript.Echo "逻辑处理器数量: " & CPU.NumberOfLogicalProcessors
WScript.Echo "地址长度: " & CPU.AddressWidth
WScript.Echo "数据长度: " & CPU.DataWidth
WScript.Echo "处理速度: " & CPU.CurrentClockSpeed & " MHz"
WScript.Echo "L2缓存: " & CPU.L2CacheSize & " B"
WScript.Echo "L3缓存: " & CPU.L3CacheSize & " B"
WScript.Echo "-"
Dim CpuStatus : CpuStatus = "处理器状态:"
Select Case CPU.CpuStatus
Case 0 : CpuStatus = CpuStatus & "Unknown"
Case 1 : CpuStatus = CpuStatus & "CPU Enabled"
Case 2 : CpuStatus = CpuStatus & "CPU Disabled by User via BIOS Setup"
Case 3 : CpuStatus = CpuStatus & "CPU Disabled by BIOS (POST Error)"
Case 4 : CpuStatus = CpuStatus & "CPU Is Idle"
Case 5 : CpuStatus = CpuStatus & "Reserved"
Case 6 : CpuStatus = CpuStatus & "Reserved"
Case 7 : CpuStatus = CpuStatus & "Other"
Case Else : CpuStatus = CpuStatus & "[CpuStatus] " & CPU.CpuStatus
End Select
WScript.Echo CpuStatus
WScript.Echo "="
Next
WScript.Echo
End Sub
'主板信息
'参考:https://msdn.microsoft.com/en-us/library/aa394072%28VS.85%29.aspx
Sub BaseBoardInfo
SetTitle "3.主板信息"
Set BaseBoards = WMI.InstancesOf("Win32_BaseBoard")
For Each BaseBoard In BaseBoards
WScript.Echo "设备名称: " & BaseBoard.Name
WScript.Echo "设备描述: " & BaseBoard.Description
WScript.Echo "设备说明: " & BaseBoard.Caption
WScript.Echo "主板型号: " & BaseBoard.Product
WScript.Echo "主板版本: " & BaseBoard.Version
WScript.Echo "制造厂商: " & BaseBoard.Manufacturer
WScript.Echo "序列号码: " & BaseBoard.SerialNumber
WScript.Echo "-"
WScript.Echo "是否底板: " & BaseBoard.HostingBoard
WScript.Echo "可热插拔: " & BaseBoard.HotSwappable
WScript.Echo "是否开启: " & BaseBoard.PoweredOn
WScript.Echo "可拆卸性: " & BaseBoard.Removable
WScript.Echo "可替换性: " & BaseBoard.Replaceable
WScript.Echo "-"
WScript.Echo "硬件状态: " & BaseBoard.Status
WScript.Echo "="
Next
WScript.Echo
End Sub
'内存信息
'参考:https://msdn.microsoft.com/en-us/library/aa394347%28VS.85%29.aspx
Sub MemoryInfo
SetTitle "4.内存信息"
Set Memorys = WMI.InstancesOf("Win32_PhysicalMemory")
For Each Memory In Memorys
WScript.Echo "设备名称: " & Memory.Name
WScript.Echo "设备描述: " & Memory.Description
WScript.Echo "设备说明: " & Memory.Caption
WScript.Echo "制造厂商: " & Memory.Manufacturer
WScript.Echo "序列号码: " & Memory.SerialNumber
WScript.Echo "-"
WScript.Echo "数据宽度: " & Memory.DataWidth
Dim FormFactor : FormFactor = "形状系数:"
Select Case Memory.FormFactor
Case 0 : FormFactor = FormFactor & "Unknown"
Case 1 : FormFactor = FormFactor & "Other"
Case 2 : FormFactor = FormFactor & "SIP"
Case 3 : FormFactor = FormFactor & "DIP"
Case 4 : FormFactor = FormFactor & "ZIP"
Case 5 : FormFactor = FormFactor & "SOJ"
Case 6 : FormFactor = FormFactor & "Proprietary"
Case 7 : FormFactor = FormFactor & "SIMM"
Case 8 : FormFactor = FormFactor & "DIMM"
Case 9 : FormFactor = FormFactor & "TSOP"
Case 10 : FormFactor = FormFactor & "PGA"
Case 11 : FormFactor = FormFactor & "RIMM"
Case 12 : FormFactor = FormFactor & "SODIMM"
Case 13 : FormFactor = FormFactor & "SRIMM"
Case 14 : FormFactor = FormFactor & "SMD"
Case 15 : FormFactor = FormFactor & "SSMP"
Case 16 : FormFactor = FormFactor & "SFP"
Case 17 : FormFactor = FormFactor & "TQFP"
Case 18 : FormFactor = FormFactor & "SOIC"
Case 19 : FormFactor = FormFactor & "LCC"
Case 20 : FormFactor = FormFactor & "PLCC"
Case 21 : FormFactor = FormFactor & "BGA"
Case 22 : FormFactor = FormFactor & "FPBGA"
Case 23 : FormFactor = FormFactor & "LGA"
Case Else : FormFactor = FormFactor & "[FormFactor] " & Memory.FormFactor
End Select
WScript.Echo FormFactor
WScript.Echo "容量统计: " & Memory.Capacity / 1024 / 1024 & "MB"
Dim MemoryType : MemoryType = "内存类型: "
Select Case Memory.MemoryType
Case 0 : MemoryType = MemoryType & "Unknown"
Case 1 : MemoryType = MemoryType & "Other"
Case 2 : MemoryType = MemoryType & "DRAM"
Case 3 : MemoryType = MemoryType & "Synchronous DRAM"
Case 4 : MemoryType = MemoryType & "Cache DRAM"
Case 5 : MemoryType = MemoryType & "EDO"
Case 6 : MemoryType = MemoryType & "EDRAM"
Case 7 : MemoryType = MemoryType & "VRAM"
Case 8 : MemoryType = MemoryType & "SRAM"
Case 9 : MemoryType = MemoryType & "RAM"
Case 10 : MemoryType = MemoryType & "ROM"
Case 11 : MemoryType = MemoryType & "Flash"
Case 12 : MemoryType = MemoryType & "EEPROM"
Case 13 : MemoryType = MemoryType & "FEPROM"
Case 14 : MemoryType = MemoryType & "EPROM"
Case 15 : MemoryType = MemoryType & "CDRAM"
Case 16 : MemoryType = MemoryType & "3DRAM"
Case 17 : MemoryType = MemoryType & "SDRAM"
Case 18 : MemoryType = MemoryType & "SGRAM"
Case 19 : MemoryType = MemoryType & "RDRAM"
Case 20 : MemoryType = MemoryType & "DDR"
Case 21 : MemoryType = MemoryType & "DDR-2"
Case Else : MemoryType = MemoryType & "[MemoryType] " & Memory.MemoryType
End Select
WScript.Echo MemoryType
WScript.Echo "安放位置: " & Memory.DeviceLocator
WScript.Echo "行中位置: " & Memory.PositionInRow
WScript.Echo "-"
Next
WScript.Echo
End Sub
'硬盘信息
'参考:https://msdn.microsoft.com/en-us/library/aa394132%28VS.85%29.aspx
Sub DiskInfo
SetTitle "5.硬盘信息"
Set Disks = WMI.ExecQuery("Select * from Win32_DiskDrive WHERE InterfaceType='IDE'")
For Each Disk In Disks
WScript.Echo "设备名称:" & Disk.Name
WScript.Echo "设备描述: " & Disk.Description
WScript.Echo "设备说明: " & Disk.Caption
WScript.Echo "硬盘名称:" & Disk.Caption
WScript.Echo "生产厂家:" & Disk.Manufacturer
WScript.Echo "硬盘序列号:" & Disk.SerialNumber
'WScript.Echo "硬盘签名:" & Disk.Signature
WScript.Echo "硬盘具有以下能力:"
For Each Capability In Disk.Capabilities
Select Case Capability
Case 0 : WScript.Echo "Unknown"
Case 1 : WScript.Echo "Other"
Case 2 : WScript.Echo "Sequential Access"
Case 3 : WScript.Echo "Random Access"
Case 4 : WScript.Echo "Supports Writing"
Case 5 : WScript.Echo "Encryption"
Case 6 : WScript.Echo "Compression"
Case 7 : WScript.Echo "Supports Removable Media"
Case 8 : WScript.Echo "Manual Cleaning"
Case 9 : WScript.Echo "Automatic Cleaning"
Case 10 : WScript.Echo "SMART Notification"
Case 11 : WScript.Echo "Supports Dual-Sided Media"
Case 12 : WScript.Echo "Ejection Prior to Drive Dismount Not Required"
Case Else : WScript.Echo "-"
End Select
Next
WScript.Echo "-"
WScript.Echo "硬盘默认分块大小:" & Disk.DefaultBlockSize
WScript.Echo "硬盘最大分块大小:" & Disk.MaxBlockSize
WScript.Echo "硬盘最小分块大小:" & Disk.MinBlockSize
WScript.Echo "硬盘扇区数:" & Disk.SectorsPerTrack
WScript.Echo "硬盘柱面数:" & Disk.TotalCylinders
WScript.Echo "硬盘总头数:" & Disk.TotalHeads
WScript.Echo "硬盘扇区数:" & Disk.TotalSectors
WScript.Echo "硬盘总道数:" & Disk.TotalTracks
WScript.Echo "硬盘总道数:" & Disk.TotalTracks
WScript.Echo "每柱磁道数:" & Disk.TracksPerCylinder
WScript.Echo "固件版本:" & Disk.FirmwareRevision
WScript.Echo "接口类型:" & Disk.InterfaceType
WScript.Echo "-"
WScript.Echo "硬盘容量:" & FormatNumber(Disk.Size / 1024 / 1024 / 1024, 3) & " GB"
WScript.Echo "="
Next
WScript.Echo
End Sub
'显卡信息
'参考:https://msdn.microsoft.com/en-us/library/aa394512%28VS.85%29.aspx
Sub GraphicsInfo
SetTitle "6.显卡信息"
Set VIDs = WMI.ExecQuery("SELECT DeviceID FROM Win32_VideoController")
For Each VID In VIDs
Set Videos = WMI.ExecQuery("SELECT * FROM Win32_VideoController WHERE DeviceID='"& VID.DeviceID &"'")
For Each Video In Videos
WScript.Echo "设备名称: " & Video.Name
WScript.Echo "设备描述: " & Video.Description
WScript.Echo "设备说明: " & Video.Caption
WScript.Echo "制造厂商: " & Video.AdapterCompatibility
Dim VideoArchitecture : VideoArchitecture = "视频架构:"
Select Case Video.VideoArchitecture
Case 1 : VideoArchitecture = VideoArchitecture & "Other"
Case 2 : VideoArchitecture = VideoArchitecture & "Unknown"
Case 3 : VideoArchitecture = VideoArchitecture & "CGA"
Case 4 : VideoArchitecture = VideoArchitecture & "EGA"
Case 5 : VideoArchitecture = VideoArchitecture & "VGA"
Case 6 : VideoArchitecture = VideoArchitecture & "SVGA"
Case 7 : VideoArchitecture = VideoArchitecture & "MDA"
Case 8 : VideoArchitecture = VideoArchitecture & "HGC"
Case 9 : VideoArchitecture = VideoArchitecture & "MCGA"
Case 10 : VideoArchitecture = VideoArchitecture & "8514A"
Case 11 : VideoArchitecture = VideoArchitecture & "XGA"
Case 12 : VideoArchitecture = VideoArchitecture & "Linear Frame Buffer"
Case 160 : VideoArchitecture = VideoArchitecture & "PC-98"
Case Else : VideoArchitecture = VideoArchitecture & "[VideoArchitecture] " & Video.VideoArchitecture
End Select
WScript.Echo VideoArchitecture
Dim VideoMemoryType : VideoMemoryType = "视频存储器类型:"
Select Case Video.VideoMemoryType
Case 1 : VideoMemoryType = VideoMemoryType & "Other"
Case 2 : VideoMemoryType = VideoMemoryType & "Unknown"
Case 3 : VideoMemoryType = VideoMemoryType & "VRAM"
Case 4 : VideoMemoryType = VideoMemoryType & "DRAM"
Case 5 : VideoMemoryType = VideoMemoryType & "SRAM"
Case 6 : VideoMemoryType = VideoMemoryType & "WRAM"
Case 7 : VideoMemoryType = VideoMemoryType & "EDO RAM"
Case 8 : VideoMemoryType = VideoMemoryType & "Burst Synchronous DRAM"
Case 9 : VideoMemoryType = VideoMemoryType & "Pipelined Burst SRAM"
Case 10 : VideoMemoryType = VideoMemoryType & "CDRAM"
Case 11 : VideoMemoryType = VideoMemoryType & "3DRAM"
Case 12 : VideoMemoryType = VideoMemoryType & "SDRAM"
Case 13 : VideoMemoryType = VideoMemoryType & "SGRAM"
Case Else : VideoMemoryType = VideoMemoryType & "[VideoMemoryType] " & Video.VideoMemoryType
End Select
Wscript.Echo VideoMemoryType
WScript.Echo "视频处理器: " & Video.VideoProcessor
WScript.Echo "-"
WScript.Echo "物理显存: " & Round(Video.AdapterRAM / 1024 / 1024)&" MB"
WScript.Echo "分辨率: " & Video.CurrentHorizontalResolution & " * " & Video.CurrentVerticalResolution
WScript.Echo "单位像素比特数:" & Video.CurrentBitsPerPixel & " Bit"
WScript.Echo "刷新频率: " & Video.CurrentRefreshRate & " Hz"
WScript.Echo "="
Next
Set Videos = Nothing
Next
Set VIDs = Nothing
WScript.Echo
End Sub
'显示器信息
'参考:https://msdn.microsoft.com/en-us/library/aa394122%28VS.85%29.aspx
Sub DisplayInfo
SetTitle "7.显示器信息"
'显示器信息
Set Monitors = WMI.ExecQuery("Select * from Win32_DesktopMonitor")
For Each Monitor In Monitors
WScript.Echo "设备名称: " & Monitor.Name
WScript.Echo "设备描述: " & Monitor.Description
WScript.Echo "设备说明: " & Monitor.Caption
WScript.Echo "显示器类型: " & Monitor.MonitorType
WScript.Echo "生产厂家: " & Monitor.MonitorManufacturer
WScript.Echo "-"
WScript.Echo "屏幕高度: " & Monitor.ScreenHeight
WScript.Echo "屏幕宽度: " & Monitor.ScreenWidth
WScript.Echo "X轴每逻辑英寸像素数: " & Monitor.PixelsPerXLogicalInch
WScript.Echo "Y轴每逻辑英寸像素数: " & Monitor.PixelsPerYLogicalInch
Dim DisplayType : DisplayType = "显示模式:"
Select Case Monitor.DisplayType
Case 0 : DisplayType = DisplayType & "Unknown"
Case 1 : DisplayType = DisplayType & "Other"
Case 2 : DisplayType = DisplayType & "Multiscan Color"
Case 3 : DisplayType = DisplayType & "Multiscan Monochrome"
Case 4 : DisplayType = DisplayType & "Fixed Frequency Color"
Case 5 : DisplayType = DisplayType & "Fixed Frequency Monochrome"
Case Else : DisplayType = DisplayType & "[DisplayType] " & Monitor.DisplayType
End Select
Wscript.Echo DisplayType
Dim StatusInfo : StatusInfo = "状态信息:"
Select Case Monitor.StatusInfo
Case 1 : StatusInfo = StatusInfo & "Other"
Case 2 : StatusInfo = StatusInfo & "Unknown"
Case 3 : StatusInfo = StatusInfo & "Enabled"
Case 4 : StatusInfo = StatusInfo & "Disabled"
Case 5 : StatusInfo = StatusInfo & "Not Applicable"
Case Else : StatusInfo = StatusInfo & "[StatusInfo] " & Monitor.StatusInfo
End Select
Wscript.Echo StatusInfo
WScript.Echo "="
Next
WScript.Echo
End Sub
'声卡信息
'参考:https://msdn.microsoft.com/en-us/library/aa394463%28VS.85%29.aspx
Sub SoundCardInfo
SetTitle "8.声卡信息"
'声卡信息
Set SoundDevices = WMI.ExecQuery("SELECT * FROM Win32_SoundDevice")
For Each SoundDevice In SoundDevices
WScript.Echo "设备名称: " & SoundDevice.Name
WScript.Echo "设备描述: " & SoundDevice.Description
WScript.Echo "设备说明: " & SoundDevice.Caption
WScript.Echo "制造厂商: " & SoundDevice.Manufacturer
Dim StatusInfo : StatusInfo = "状态信息:"
Select Case SoundDevice.StatusInfo
Case 1 : StatusInfo = StatusInfo & "Other"
Case 2 : StatusInfo = StatusInfo & "Unknown"
Case 3 : StatusInfo = StatusInfo & "Enabled"
Case 4 : StatusInfo = StatusInfo & "Disabled"
Case 5 : StatusInfo = StatusInfo & "Not Applicable"
Case Else : StatusInfo = StatusInfo & "[StatusInfo] " & SoundDevice.StatusInfo
End Select
Wscript.Echo StatusInfo
WScript.Echo "="
Next
Set SoundDevices = Nothing
WScript.Echo
End Sub
'网卡信息
'参考:https://msdn.microsoft.com/en-us/library/aa394216%28v=vs.85%29.aspx
Sub NetworkCardInfo
SetTitle "9.网卡信息"
'网卡信息
Set Networks = WMI.ExecQuery("Select * from Win32_NetworkAdapter WHERE PhysicalAdapter ='TRUE'")
For Each Network In Networks
WScript.Echo "设备名称: " & Network.Name
WScript.Echo "设备描述: " & Network.Description
WScript.Echo "设备说明: " & Network.Caption
WScript.Echo "适配器型号: " & Network.AdapterType
WScript.Echo "生产厂商: " & Network.Manufacturer
WScript.Echo "设备标识: " & Network.DeviceID
WScript.Echo "GUID: "& Network.GUID
WScript.Echo "MAC: "& Network.MACAddress
WScript.Echo "-"
If Network.NetEnabled = TRUE Then
WScript.Echo "活跃状态:" & "活跃"
Else
WScript.Echo "活跃状态:" & "空闲"
End If
Dim NetConnectionStatus : NetConnectionStatus = "状态信息:"
Select Case Network.NetConnectionStatus
Case 0 : NetConnectionStatus = NetConnectionStatus & "Disconnected"
Case 1 : NetConnectionStatus = NetConnectionStatus & "Connecting"
Case 2 : NetConnectionStatus = NetConnectionStatus & "Connected"
Case 3 : NetConnectionStatus = NetConnectionStatus & "Disconnecting"
Case 4 : NetConnectionStatus = NetConnectionStatus & "Hardware not present"
Case 5 : NetConnectionStatus = NetConnectionStatus & "Hardware disabled"
Case 6 : NetConnectionStatus = NetConnectionStatus & "Hardware malfunction"
Case 7 : NetConnectionStatus = NetConnectionStatus & "Media disconnected"
Case 8 : NetConnectionStatus = NetConnectionStatus & "Authenticating"
Case 9 : NetConnectionStatus = NetConnectionStatus & "Authentication succeeded"
Case 10 : NetConnectionStatus = NetConnectionStatus & "Authentication failed"
Case 11 : NetConnectionStatus = NetConnectionStatus & "Invalid address"
Case 12 : NetConnectionStatus = NetConnectionStatus & "Credentials required"
Case Else : NetConnectionStatus = NetConnectionStatus & "[NetConnectionStatus] " & Network.NetConnectionStatus
End Select
Wscript.Echo NetConnectionStatus
WScript.Echo "="
Next
Set cNet = Nothing
WScript.Echo
End Sub
'键盘信息
'参考:https://msdn.microsoft.com/en-us/library/aa394166%28v=vs.85%29.aspx
Sub KeyBoardInfo
SetTitle "10.键盘信息"
Set Keyboards = WMI.ExecQuery("Select * from Win32_Keyboard")
For Each Keyboard In Keyboards
WScript.Echo "设备名称: " & Keyboard.Name
WScript.Echo "设备描述: " & Keyboard.Description
WScript.Echo "设备说明: " & Keyboard.Caption
WScript.Echo "功能键数量: " & Keyboard.NumberOfFunctionKeys
Next
WScript.Echo
End Sub
'电池信息
Sub BatteryInfo
SetTitle "11.电池信息"
Set Batterys = WMI.ExecQuery("Select * from Win32_Battery")
For Each Battery In Batterys
WScript.Echo "设备名称: "& Battery.Name
WScript.Echo "设备描述: "& Battery.Description
WScript.Echo "设备说明: " & Battery.Caption
Dim Chemistry : Chemistry = "电池类型:"
Select Case Battery.Chemistry
Case 1 : Chemistry = Chemistry & "Other"
Case 2 : Chemistry = Chemistry & "Unknown"
Case 3 : Chemistry = Chemistry & "Lead Acid"
Case 4 : Chemistry = Chemistry & "Nickel Cadmium"
Case 5 : Chemistry = Chemistry & "Nickel Metal Hydride"
Case 6 : Chemistry = Chemistry & "Lithium-ion"
Case 7 : Chemistry = Chemistry & "Zinc air"
Case 8 : Chemistry = Chemistry & "Lithium Polymer"
Case Else : Chemistry = Chemistry & "[Chemistry] " & Battery.Chemistry
End Select
WScript.Echo Chemistry
WScript.Echo "设计容量: " & Battery.DesignCapacity & " milliwatt-hour(s)"
WScript.Echo "设计电压: " & Battery.DesignVoltage & " millivolt(s)"
Next
WScript.Echo
End Sub
'指示设备信息
'参考:https://msdn.microsoft.com/en-us/library/aa394356.aspx
Sub PointingDeviceInfo
SetTitle "12.指示设备信息"
Set PointingDevices = WMI.ExecQuery("Select * from Win32_PointingDevice")
For Each PointingDevice In PointingDevices
WScript.Echo "设备名称: "& PointingDevice.Name
WScript.Echo "设备描述: "& PointingDevice.Description
WScript.Echo "设备说明: " & PointingDevice.Caption
WScript.Echo "生产厂家: " & PointingDevice.Manufacturer
Dim DeviceInterface : DeviceInterface = ""
Select Case PointingDevice.DeviceInterface
Case 1 : DeviceInterface = DeviceInterface & "Other"
Case 2 : DeviceInterface = DeviceInterface & "Unknown"
Case 3 : DeviceInterface = DeviceInterface & "Serial"
Case 4 : DeviceInterface = DeviceInterface & "PS/2"
Case 5 : DeviceInterface = DeviceInterface & "Infrared"
Case 6 : DeviceInterface = DeviceInterface & "HP-HIL"
Case 7 : DeviceInterface = DeviceInterface & "Bus Mouse"
Case 8 : DeviceInterface = DeviceInterface & "ADB (Apple Desktop Bus)"
Case 160 : DeviceInterface = DeviceInterface & "Bus Mouse DB-9"
Case 161 : DeviceInterface = DeviceInterface & "Bus Mouse Micro-DIN"
Case 162 : DeviceInterface = DeviceInterface & "USB"
Case Else : DeviceInterface = DeviceInterface & "[DeviceInterface] " & PointingDevice.DeviceInterface
End Select
WScript.Echo DeviceInterface
WScript.Echo "硬件类型: " & PointingDevice.HardwareType
WScript.Echo "="
Next
WScript.Echo
End Sub
'光驱设备
'参考:https://msdn.microsoft.com/en-us/library/aa394081.aspx
Sub CDROMDriveInfo
SetTitle "13.光驱设备"
Set CDROMDrives = WMI.ExecQuery("Select * from Win32_CDROMDrive")
For Each CDROMDrive In CDROMDrives
WScript.Echo "设备名称: "& CDROMDrive.Name
WScript.Echo "设备描述: "& CDROMDrive.Description
WScript.Echo "设备说明: " & CDROMDrive.Caption
WScript.Echo "生产厂家: " & CDROMDrive.Manufacturer
WScript.Echo "="
Next
WScript.Echo
End Sub
'其他硬件
Sub OtherHardware
'SetTitle "其他信息"
'WScript.Echo
End Sub
'运行统计
Sub RunStats
SetTitle "运行统计"
WScript.Echo "检查开始时间:" & StartTime
WScript.Echo "检查结束时间:" & FinishTime
WScript.Echo "检查用时:" & DateDiff("s", StartTime, FinishTime) & " 秒"
WScript.Echo
End Sub
3)打印结果:Result.txt
以下是我在我目前工作用的电脑上运行的结果。运行环境为:Windows10专业版
Microsoft (R) Windows Script Host Version 5.812
版权所有(C) Microsoft Corporation。保留所有权利。
----------1.系统概览----------
生产厂家:Gigabyte Technology Co., Ltd.
当前用户:EPERMARKET\chengl
----------2.处理器信息----------
设备名称: Intel(R) Core(TM) i5-4670 CPU @ 3.40GHz
设备描述: Intel64 Family 6 Model 60 Stepping 3
设备说明: Intel64 Family 6 Model 60 Stepping 3
处理器标识: BFEBFBFF000306C3
处理器类型:Central Processor
处理器版本:
设备标识: CPU0
处理器家族:Intel Core(TM) i7-2760QM
处理器架构:x64
-
内核数量: 4
逻辑处理器数量: 4
地址长度: 64
数据长度: 64
处理速度: 3401 MHz
L2缓存: 1024 B
L3缓存: 6144 B
-
处理器状态:CPU Enabled
=
----------3.主板信息----------
设备名称: 基板
设备描述: 基板
设备说明: 基板
主板型号: Z87P-D3
主板版本: x.x
制造厂商: Gigabyte Technology Co., Ltd.
序列号码: To be filled by O.E.M.
-
是否底板: True
可热插拔: False
是否开启: True
可拆卸性: False
可替换性: True
-
硬件状态: OK
=
----------4.内存信息----------
设备名称: 物理内存
设备描述: 物理内存
设备说明: 物理内存
制造厂商: Kingston
序列号码: 34222222
-
数据宽度: 64
形状系数:DIMM
容量统计: 8192MB
内存类型: [MemoryType] 24
安放位置: ChannelA-DIMM1
行中位置:
-
设备名称: 物理内存
设备描述: 物理内存
设备说明: 物理内存
制造厂商: Kingston
序列号码: 36225323
-
数据宽度: 64
形状系数:DIMM
容量统计: 8192MB
内存类型: [MemoryType] 24
安放位置: ChannelB-DIMM1
行中位置:
-
----------5.硬盘信息----------
设备名称:\\.\PHYSICALDRIVE1
设备描述: 磁盘驱动器
设备说明: ST3500413AS
硬盘名称:ST3500413AS
生产厂家:(标准磁盘驱动器)
硬盘序列号: S2A1B28R
硬盘具有以下能力:
Random Access
Supports Writing
-
硬盘默认分块大小:
硬盘最大分块大小:
硬盘最小分块大小:
硬盘扇区数:63
硬盘柱面数:60801
硬盘总头数:255
硬盘扇区数:976768065
硬盘总道数:15504255
硬盘总道数:15504255
每柱磁道数:255
固件版本:JC66
接口类型:IDE
-
硬盘容量:465.759 GB
=
设备名称:\\.\PHYSICALDRIVE0
设备描述: 磁盘驱动器
设备说明: Samsung SSD 860 EVO 250GB
硬盘名称:Samsung SSD 860 EVO 250GB
生产厂家:(标准磁盘驱动器)
硬盘序列号:S3YLNX0K643124X
硬盘具有以下能力:
Random Access
Supports Writing
-
硬盘默认分块大小:
硬盘最大分块大小:
硬盘最小分块大小:
硬盘扇区数:63
硬盘柱面数:30401
硬盘总头数:255
硬盘扇区数:488392065
硬盘总道数:7752255
硬盘总道数:7752255
每柱磁道数:255
固件版本:RVT01B6Q
接口类型:IDE
-
硬盘容量:232.883 GB
=
----------6.显卡信息----------
设备名称: Intel(R) HD Graphics 4600
设备描述: Intel(R) HD Graphics 4600
设备说明: Intel(R) HD Graphics 4600
制造厂商: Intel Corporation
视频架构:VGA
视频存储器类型:Unknown
视频处理器: Intel(R) HD Graphics Family
-
物理显存: 1024 MB
分辨率: *
单位像素比特数: Bit
刷新频率: Hz
=
设备名称: NVIDIA GeForce 210
设备描述: NVIDIA GeForce 210
设备说明: NVIDIA GeForce 210
制造厂商: NVIDIA
视频架构:VGA
视频存储器类型:Unknown
视频处理器: GeForce 210
-
物理显存: 1024 MB
分辨率: 1920 * 1080
单位像素比特数:32 Bit
刷新频率: 60 Hz
=
----------7.显示器信息----------
设备名称: 默认监视器
设备描述: 默认监视器
设备说明: 默认监视器
显示器类型: 默认监视器
生产厂家:
-
屏幕高度:
屏幕宽度:
X轴每逻辑英寸像素数: 96
Y轴每逻辑英寸像素数: 96
显示模式:[DisplayType]
状态信息:[StatusInfo]
=
设备名称: 通用即插即用监视器
设备描述: 通用即插即用监视器
设备说明: 通用即插即用监视器
显示器类型: 通用即插即用监视器
生产厂家: (标准监视器类型)
-
屏幕高度: 1080
屏幕宽度: 1920
X轴每逻辑英寸像素数: 96
Y轴每逻辑英寸像素数: 96
显示模式:[DisplayType]
状态信息:[StatusInfo]
=
----------8.声卡信息----------
设备名称: Realtek High Definition Audio
设备描述: Realtek High Definition Audio
设备说明: Realtek High Definition Audio
制造厂商: Realtek
状态信息:Enabled
=
设备名称: NVIDIA High Definition Audio
设备描述: NVIDIA High Definition Audio
设备说明: NVIDIA High Definition Audio
制造厂商: NVIDIA
状态信息:Enabled
=
设备名称: NVIDIA High Definition Audio
设备描述: NVIDIA High Definition Audio
设备说明: NVIDIA High Definition Audio
制造厂商: NVIDIA
状态信息:Enabled
=
设备名称: NVIDIA High Definition Audio
设备描述: NVIDIA High Definition Audio
设备说明: NVIDIA High Definition Audio
制造厂商: NVIDIA
状态信息:Enabled
=
设备名称: NVIDIA High Definition Audio
设备描述: NVIDIA High Definition Audio
设备说明: NVIDIA High Definition Audio
制造厂商: NVIDIA
状态信息:Enabled
=
设备名称: 英特尔(R) 显示器音频
设备描述: 英特尔(R) 显示器音频
设备说明: 英特尔(R) 显示器音频
制造厂商: Intel(R) Corporation
状态信息:Enabled
=
----------9.网卡信息----------
设备名称: Realtek PCIe GBE Family Controller
设备描述: Realtek PCIe GBE Family Controller
设备说明: [00000001] Realtek PCIe GBE Family Controller
适配器型号: 以太网 802.3
生产厂商: Realtek
设备标识: 1
GUID: {2F5CF3E3-AD76-48E1-A2F5-05737B3268AE}
MAC: 74:D4:35:9C:B8:7B
-
活跃状态:空闲
状态信息:Media disconnected
=
设备名称: Realtek RTL8139/810x Family Fast Ethernet NIC
设备描述: Realtek RTL8139/810x Family Fast Ethernet NIC
设备说明: [00000002] Realtek RTL8139/810x Family Fast Ethernet NIC
适配器型号: 以太网 802.3
生产厂商: Realtek Semiconductor Corp.
设备标识: 2
GUID: {B17FDE51-A7E6-4D1E-A287-AAF55CB7506B}
MAC: C8:3A:35:D4:A3:3F
-
活跃状态:活跃
状态信息:Connected
=
设备名称: VMware Virtual Ethernet Adapter for VMnet1
设备描述: VMware Virtual Ethernet Adapter for VMnet1
设备说明: [00000003] VMware Virtual Ethernet Adapter for VMnet1
适配器型号: 以太网 802.3
生产厂商: VMware, Inc.
设备标识: 3
GUID: {A7AC7AB8-BC99-49EB-ADFD-EDCABCAAB0E4}
MAC: 00:50:56:C0:00:01
-
活跃状态:活跃
状态信息:Connected
=
设备名称: VMware Virtual Ethernet Adapter for VMnet8
设备描述: VMware Virtual Ethernet Adapter for VMnet8
设备说明: [00000004] VMware Virtual Ethernet Adapter for VMnet8
适配器型号: 以太网 802.3
生产厂商: VMware, Inc.
设备标识: 4
GUID: {4A912137-BFE6-4A53-B65E-5A9CCAC8BBB5}
MAC: 00:50:56:C0:00:08
-
活跃状态:活跃
状态信息:Connected
=
----------10.键盘信息----------
设备名称: 增强型(101 或 102 键)
设备描述: USB 输入设备
设备说明: 增强型(101 或 102 键)
功能键数量: 12
----------11.电池信息----------
----------12.指示设备信息----------
设备名称: USB 输入设备
设备描述: USB 输入设备
设备说明: USB 输入设备
生产厂家: (标准系统设备)
USB
硬件类型: USB 输入设备
=
----------13.光驱设备----------
----------运行统计----------
检查开始时间:2019/8/9 13:38:18
检查结束时间:2019/8/9 13:38:19
检查用时:1 秒