亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > 編程 > Visual Basic > 正文

VB中使用WMI獲取系統硬件和軟件有關信息

2020-01-31 16:30:37
字體:
來源:轉載
供稿:網友

WMI是英文Windows Management Instrumentation的簡寫,它的功能主要是:訪問本地主機的一些信息和服務,可以管理遠程計算機(當然你必須要擁有足夠的權限),比如:重啟,關機,關閉進程,創建進程等。

當然此文是適用于vbscript

微軟官方的資料:

實例如下:

用WMI,先工程-引用 Microsoft WMI Scripting V1.1 Library

獲取顯卡/聲卡/內存/操作系統的信息

聲卡信息

Private Sub wmiSoundDeviceInfo()Dim wmiObjSet As SWbemObjectSetDim obj As SWbemObjectSet wmiObjSet = GetObject(winmgmts:{impersonationLevel=impersonate}). _InstancesOf(Win32_SoundDevice)On Local Error Resume NextFor Each obj In wmiObjSetMsgBox obj.ProductNameNextEnd Sub

顯卡信息

Private Sub wmiVideoControllerInfo()Dim wmiObjSet As SWbemObjectSetDim obj As SWbemObjectSet wmiObjSet = GetObject(winmgmts:{impersonationLevel=impersonate}). _InstancesOf(Win32_VideoController)On Local Error Resume NextFor Each obj In wmiObjSetMsgBox obj.VideoProcessorNextEnd Sub

內存信息

Private Sub wmiPhysicalMemoryInfo()Dim wmiObjSet As SWbemObjectSetDim obj As SWbemObjectSet wmiObjSet = GetObject(winmgmts:{impersonationLevel=impersonate}). _InstancesOf(Win32_PhysicalMemory)On Local Error Resume NextFor Each objItem In wmiObjSetDebug.Print BankLabel: & objItem.BankLabelDebug.Print Capacity: & objItem.CapacityDebug.Print Caption: & objItem.CaptionDebug.Print CreationClassName: & objItem.CreationClassNameDebug.Print DataWidth: & objItem.DataWidthDebug.Print Description: & objItem.DescriptionDebug.Print DeviceLocator: & objItem.DeviceLocatorDebug.Print FormFactor: & objItem.FormFactorDebug.Print HotSwappable: & objItem.HotSwappableDebug.Print InstallDate: & objItem.InstallDateDebug.Print InterleaveDataDepth: & objItem.InterleaveDataDepthDebug.Print InterleavePosition: & objItem.InterleavePositionDebug.Print Manufacturer: & objItem.ManufacturerDebug.Print MemoryType: & objItem.MemoryTypeDebug.Print Model: & objItem.ModelDebug.Print Name: & objItem.nameDebug.Print OtherIdentifyingInfo: & objItem.OtherIdentifyingInfoDebug.Print PartNumber: & objItem.PartNumberDebug.Print PositionInRow: & objItem.PositionInRowDebug.Print PoweredOn: & objItem.PoweredOnDebug.Print Removable: & objItem.RemovableDebug.Print Replaceable: & objItem.ReplaceableDebug.Print SerialNumber: & objItem.SerialNumberDebug.Print SKU: & objItem.SKUDebug.Print Speed: & objItem.SpeedDebug.Print Status: & objItem.StatusDebug.Print Tag: & objItem.TagDebug.Print TotalWidth: & objItem.TotalWidthDebug.Print TypeDetail: & objItem.TypeDetailDebug.Print Version: & objItem.VersionNextEnd Sub

操作系統信息

Private Sub Command1_Click()Dim wmiObjSet As SWbemObjectSetDim obj As SWbemObjectDim msg As StringDim dtb As StringDim d As StringDim t As StringDim bias As LongOn Local Error Resume NextSet wmiObjSet = GetObject(winmgmts:{impersonationLevel=impersonate}).InstancesOf(Win32_OperatingSystem)For Each obj In wmiObjSetMsgBox 你當前使用的系統是 & obj.CaptionNextEnd Sub

說明:

大家可能會發現一個規律,實際上WMI對信息的提取都是使用了WIN32_類庫名這樣的規律,下列表格就是微軟的操作系統各種硬件類的描述

其它WMI管理的類的信息在

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/accessing_hardware_and_software_through_wmi.asp

可以找到,其中也還有部分示例代碼

簡單Win_32類表

Win32 Classes
Microsoft® Windows® classes give you the means to manipulate a variety of objects. The following table identifies the categories of Windows classes.

Category Description
Computer system hardware Classes that represent hardware related objects.
Operating system Classes that represent operating system related objects.
Installed applications Classes that represent software related objects.
WMI service management Classes used to manage WMI.
Performance counters Classes that represent formatted and raw performance data.

硬件類
Computer System Hardware Classes
he Cooling Devices subcategory groups classes that represent instrumentable fans, temperature probes, and refrigeration devices.

Class Description
Win32_Fan Represents the properties of a fan device in the computer system.
Win32_HeatPipe Represents the properties of a heat pipe cooling device.
Win32_Refrigeration Represents the properties of a refrigeration device.
Win32_TemperatureProbe Represents the properties of a temperature sensor (electronic thermometer).

Input Device Classes

The Input Devices subcategory groups classes that represent keyboards and pointing devices.

Class Description
Win32_Keyboard Represents a keyboard installed on a Windows system.
Win32_PointingDevice Represents an input device used to point to and select regions on the display of a Windows computer system.

Mass Storage Classes

Classes in the Mass Storage subcategory represent storage devices such as hard disk drives, CD-ROM drives, and tape drives.

Class Description
Win32_AutochkSetting Represents the settings for the autocheck operation of a disk.
Win32_CDROMDrive Represents a CD-ROM drive on a Windows computer system.
Win32_DiskDrive Represents a physical disk drive as seen by a computer running the Windows operating system.
Win32_FloppyDrive Manages the capabilities of a floppy disk drive.
Win32_PhysicalMedia Represents any type of documentation or storage medium.
Win32_TapeDrive Represents a tape drive on a Windows computer.

Motherboard, Controller, and Port Classes

The Motherboard, Controllers, and Ports subcategory groups classes that represent system devices. Examples include system memory, cache memory, and controllers.

Class Description
Win32_1394Controller Represents the capabilities and management of a 1394 controller.
Win32_1394ControllerDevice Relates the high-speed serial bus (IEEE 1394 Firewire) Controller and the CIM_LogicalDevice instance connected to it.
Win32_AllocatedResource Relates a logical device to a system resource.
Win32_AssociatedProcessorMemory Relates a processor and its cache memory.
Win32_BaseBoard Represents a baseboard (also known as a motherboard or system board).
Win32_BIOS Represents the attributes of the computer system's basic input/output services (BIOS) that are installed on the computer.
Win32_Bus Represents a physical bus as seen by a Windows operating system.
Win32_CacheMemory Represents cache memory (internal and external) on a computer system.
Win32_ControllerHasHub Represents the hubs downstream from the universal serial bus (USB) controller.
Win32_DeviceBus Relates a system bus and a logical device using the bus.
Win32_DeviceMemoryAddress Represents a device memory address on a Windows system.
Win32_DeviceSettings Relates a logical device and a setting that can be applied to it.
Win32_DMAChannel Represents a direct memory access (DMA) channel on a Windows computer system.
Win32_FloppyController Represents the capabilities and management capacity of a floppy disk drive controller.
Win32_IDEController Represents the capabilities of an Integrated Drive Electronics (IDE) controller device.
Win32_IDEControllerDevice Association class that relates an IDE controller and the logical device.
Win32_InfraredDevice Represents the capabilities and management of an infrared device.
Win32_IRQResource Represents an interrupt request line (IRQ) number on a Windows computer system.
Win32_MemoryArray Represents the properties of the computer system memory array and mapped addresses.
Win32_MemoryArrayLocation Relates a logical memory array and the physical memory array upon which it exists.
Win32_MemoryDevice Represents the properties of a computer system's memory device along with it's associated mapped addresses.
Win32_MemoryDeviceArray Relates a memory device and the memory array in which it resides.
Win32_MemoryDeviceLocation Association class that relates a memory device and the physical memory on which it exists.
Win32_MotherboardDevice Represents a device that contains the central components of the Windows computer system.
Win32_OnBoardDevice Represents common adapter devices built into the motherboard (system board).
Win32_ParallelPort Represents the properties of a parallel port on a Windows computer system.
Win32_PCMCIAController Manages the capabilities of a Personal Computer Memory Card Interface Adapter (PCMCIA) controller device.
Win32_PhysicalMemory Represents a physical memory device located on a computer as available to the operating system.
Win32_PhysicalMemoryArray Represents details about the computer system's physical memory.
Win32_PhysicalMemoryLocation Relates an array of physical memory and its physical memory.
Win32_PNPAllocatedResource Represents an association between logical devices and system resources.
Win32_PNPDevice Relates a device (known to Configuration Manager as a PNPEntity), and the function it performs.
Win32_PNPEntity Represents the properties of a Plug and Play device.
Win32_PortConnector Represents physical connection ports, such as DB-25 pin male, Centronics, and PS/2.
Win32_PortResource Represents an I/O port on a Windows computer system.
Win32_Processor Represents a device capable of interpreting a sequence of machine instructions on a Windows computer system.
Win32_SCSIController Represents a small computer system interface (SCSI) controller on a Windows system.
Win32_SCSIControllerDevice Relates a SCSI controller and the logical device (disk drive) connected to it.
Win32_SerialPort Represents a serial port on a Windows system.
Win32_SerialPortConfiguration Represents the settings for data transmission on a Windows serial port.
Win32_SerialPortSetting Relates a serial port and its configuration settings.
Win32_SMBIOSMemory Represents the capabilities and management of memory-related logical devices.
Win32_SoundDevice Represents the properties of a sound device on a Windows computer system.
Win32_SystemBIOS Relates a computer system (including data such as startup properties, time zones, boot configurations, or administrative passwords) and a system BIOS (services, languages, system management properties).
Win32_SystemDriverPNPEntity Relates a Plug and Play device on the Windows computer system and the driver that supports the Plug and Play device.
Win32_SystemEnclosure Represents the properties associated with a physical system enclosure.
Win32_SystemMemoryResource Represents a system memory resource on a Windows system.
Win32_SystemSlot Represents physical connection points including ports, motherboard slots and peripherals, and proprietary connections points.
Win32_USBController Manages the capabilities of a universal serial bus (USB) controller.
Win32_USBControllerDevice Relates a USB controller and the CIM_LogicalDevice instances connected to it.
Win32_USBHub Represents the management characteristics of a USB hub.


Networking Device Classes

The Networking Devices subcategory groups classes that represent the network interface controller, its configurations, and its settings.

Class Description
Win32_NetworkAdapter Represents a network adapter on a Windows system.
Win32_NetworkAdapterConfiguration Represents the attributes and behaviors of a network adapter. The class is not guaranteed to be supported after the ratification of the Distributed Management Task Force (DMTF) CIM network specification.
Win32_NetworkAdapterSetting Relates a network adapter and its configuration settings.


Power Classes

The Power subcategory groups classes that represent power supplies, batteries, and events related to these devices.

Class Description
Win32_AssociatedBattery Relates a logical device and the battery it is using.
Win32_Battery Represents a battery connected to the computer system.
Win32_CurrentProbe Represents the properties of a current monitoring sensor (ammeter).
Win32_PortableBattery Represents the properties of a portable battery, such as one used for a notebook computer.
Win32_PowerManagementEvent Represents power management events resulting from power state changes.
Win32_UninterruptiblePowerSupply Represents the capabilities and management capacity of an uninterruptible power supply (UPS).
Win32_VoltageProbe Represents the properties of a voltage sensor (electronic voltmeter).


Printing Classes

The Printing subcategory groups classes that represent printers, printer configurations, and print jobs.

Class Description
Win32_DriverForDevice Relates a printer to a printer driver.
Win32_Printer Represents a device connected to a Windows computer system that is capable of reproducing a visual image on a medium.
Win32_PrinterConfiguration Defines the configuration for a printer device.
Win32_PrinterController Relates a printer and the local device to which the printer is connected.
Win32_PrinterDriver Represents the drivers for a Win32_Printer instance.
Win32_PrinterDriverDll Relates a local printer and its driver file (not the driver itself).
Win32_PrinterSetting Relates a printer and its configuration settings.
Win32_PrintJob Represents a print job generated by a Windows application.
Win32_TCPIPPrinterPort Represents a TCP/IP service access point.

Telephony Classes

The Telephony subcategory groups classes that represent plain old telephone modem devices and their associated serial connections.

Class Description
Win32_POTSModem Represents the services and characteristics of a Plain Old Telephone Service (POTS) modem on a Windows system.
Win32_POTSModemToSerialPort Relates a modem and the serial port the modem uses.


Video and Monitor Classes

The Video and Monitors subcategory groups classes that represent monitors, video cards, and their associated settings.

Class Description
Win32_DesktopMonitor Represents the type of monitor or display device attached to the computer system.
Win32_DisplayConfiguration Represents configuration information for the display device on a Windows system. This class is obsolete. In place of this class, use the properties in the Win32_VideoController, Win32_DesktopMonitor, and CIM_VideoControllerResolution classes.
Win32_DisplayControllerConfiguration Represents the video adapter configuration information of a Windows system. This class is obsolete. In place of this class, use the properties in the Win32_VideoController, Win32_DesktopMonitor, and CIM_VideoControllerResolution classes.
Win32_VideoConfiguration This class has been eliminated from Windows XP and later; attempts to use it will generate a fatal error. In place of this class, use the properties contained in the Win32_VideoController, Win32_DesktopMonitor, and CIM_VideoControllerResolution classes.
Win32_VideoController Represents the capabilities and management capacity of the video controller on a Windows computer system.
Win32_VideoSettings Relates a video controller and video settings that can be applied to it.

而每一個類都有對應的數據結構如

顯卡

class Win32_VideoController : CIM_PCVideoController
{
uint16 AcceleratorCapabilities[];
string AdapterCompatibility;
string AdapterDACType;
uint32 AdapterRAM;
uint16 Availability;
string CapabilityDescriptions[];
string Caption;
uint32 ColorTableEntries;
uint32 ConfigManagerErrorCode;
boolean ConfigManagerUserConfig;
string CreationClassName;
uint32 CurrentBitsPerPixel;
uint32 CurrentHorizontalResolution;
uint64 CurrentNumberOfColors;
uint32 CurrentNumberOfColumns;
uint32 CurrentNumberOfRows;
uint32 CurrentRefreshRate;
uint16 CurrentScanMode;
uint32 CurrentVerticalResolution;
string Description;
string DeviceID;
uint32 DeviceSpecificPens;
uint32 DitherType;
datetime DriverDate;
string DriverVersion;
boolean ErrorCleared;
string ErrorDescription;
uint32 ICMIntent;
uint32 ICMMethod;
string InfFilename;
string InfSection;
datetime InstallDate;
string InstalledDisplayDrivers;
uint32 LastErrorCode;
uint32 MaxMemorySupported;
uint32 MaxNumberControlled;
uint32 MaxRefreshRate;
uint32 MinRefreshRate;
boolean Monochrome;
string Name;
uint16 NumberOfColorPlanes;
uint32 NumberOfVideoPages;
string PNPDeviceID;
uint16 PowerManagementCapabilities[];
boolean PowerManagementSupported;
uint16 ProtocolSupported;
uint32 ReservedSystemPaletteEntries;
uint32 SpecificationVersion;
string Status;
uint16 StatusInfo;
string SystemCreationClassName;
string SystemName;
uint32 SystemPaletteEntries;
datetime TimeOfLastReset;
uint16 VideoArchitecture;
uint16 VideoMemoryType;
uint16 VideoMode;
string VideoModeDescription;
string VideoProcessor;
};

聲卡等

class Win32_SoundDevice : CIM_LogicalDevice
{
uint16 Availability;
string Caption;
uint32 ConfigManagerErrorCode;
boolean ConfigManagerUserConfig;
string CreationClassName;
string Description;
string DeviceID;
uint16 DMABufferSize;
boolean ErrorCleared;
string ErrorDescription;
datetime InstallDate;
uint32 LastErrorCode;
string Manufacturer;
uint32 MPU401Address;
string Name;
string PNPDeviceID;
uint16 PowerManagementCapabilities[];
boolean PowerManagementSupported;
string ProductName;
string Status;
uint16 StatusInfo;
string SystemCreationClassName;
string SystemName;
};

class Win32_PrintJob : CIM_Job
{
string Caption;
string DataType;
string Description;
string Document;
string DriverName;
datetime ElapsedTime;
string HostPrintQueue;
datetime InstallDate;
uint32 JobId;
string JobStatus;
string Name;
string Notify;
string Owner;
uint32 PagesPrinted;
string Parameters;
string PrintProcessor;
uint32 Priority;
uint32 Size;
datetime StartTime;
string Status;
uint32 StatusMask;
datetime TimeSubmitted;
uint32 TotalPages;
datetime UntilTime;
};

Set wmiObjSet = GetObject(winmgmts:{impersonationLevel=impersonate}). _
InstancesOf(Win32_PrintJob)

可以獲得打印任務列表等信息

對于VB來講獲得系統硬件和軟件信息大都使用API,現在使用WMI可以快速的實現我們的目標.如獲取驅動器/顯卡/共享信息等等都會變得方便和有效

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
国产精品美女无圣光视频| 91国内揄拍国内精品对白| 91久久在线观看| 亚洲综合一区二区不卡| 亚洲一区二区三区在线视频| 91在线无精精品一区二区| 亚洲电影在线观看| 成人有码在线播放| 国产在线观看91精品一区| 欧美一级bbbbb性bbbb喷潮片| 久久久久九九九九| 欧美综合第一页| 欧美日韩在线看| 国产一区二区在线免费视频| 91精品国产99| 欧美精品做受xxx性少妇| 这里只有精品在线播放| 欧美高跟鞋交xxxxhd| 久久久亚洲精选| 欧美最顶级丰满的aⅴ艳星| 欧美在线免费看| 国产精品国产福利国产秒拍| www.99久久热国产日韩欧美.com| 国产精品久久久久av| 国产成人精品在线播放| 欧美寡妇偷汉性猛交| 自拍偷拍亚洲区| 欧美激情一级二级| 国产精品久久久久久久久久久久| 欧美日韩久久久久| 激情亚洲一区二区三区四区| 日韩视频中文字幕| 国产精品美女免费| 91国产视频在线| 精品一区二区三区四区| 91精品久久久久久久久中文字幕| 色噜噜亚洲精品中文字幕| 久久综合免费视频| 国产成人精品久久二区二区91| 国产女人18毛片水18精品| 久久久久久这里只有精品| 久久久久国产一区二区三区| 在线成人中文字幕| 久久影院模特热| 欧美精品18videos性欧美| 91九色综合久久| 日韩在线播放av| 成年人精品视频| 国产精自产拍久久久久久蜜| 国产一区二区三区中文| 日韩一二三在线视频播| 国产精品一区二区av影院萌芽| 在线精品视频视频中文字幕| 精品偷拍各种wc美女嘘嘘| 97avcom| www高清在线视频日韩欧美| 亚洲mm色国产网站| 国产成人精品一区二区三区| 福利视频导航一区| 日韩欧美亚洲范冰冰与中字| 欧美大胆在线视频| 欧美日韩久久久久| 国产欧美精品一区二区三区介绍| 欧美日韩中文字幕在线| 欧美日韩中文在线观看| 亚洲一区二区三区乱码aⅴ蜜桃女| 亚洲一区二区三区久久| 91精品久久久久久综合乱菊| 91免费综合在线| 亚洲视频在线视频| 免费不卡在线观看av| 亚洲精选在线观看| 亚洲成人精品视频| 国产在线观看不卡| 欧美精品18videos性欧| 色多多国产成人永久免费网站| 中文国产亚洲喷潮| 日韩女在线观看| 亚洲日韩欧美视频| 97在线视频一区| 国产精品高清网站| 91精品国产网站| 久久这里只有精品99| 亚洲国产日韩精品在线| 青青青国产精品一区二区| 中文字幕自拍vr一区二区三区| 久久精品99无色码中文字幕| 国产欧美日韩最新| 日韩精品极品视频| 欧美成人精品影院| 欧美黑人一区二区三区| 国内精品久久久久| 日韩一中文字幕| 亚洲精品欧美极品| 欧美高跟鞋交xxxxxhd| 国产精品视频资源| 亚洲精品福利在线| 91网在线免费观看| 伊人av综合网| www.欧美三级电影.com| 自拍偷拍亚洲区| 亚洲国产精品嫩草影院久久| 欧美大尺度电影在线观看| 欧美激情国产日韩精品一区18| 欧美激情精品久久久久久变态| 亚洲激情第一页| 日韩亚洲一区二区| 亚洲影院色无极综合| 久久精品亚洲一区| 欧美中文在线观看| 国产综合色香蕉精品| 亚洲一区二区中文字幕| 欧美成人久久久| 欧美专区在线观看| 欧美性生交大片免费| 中文欧美日本在线资源| 少妇高潮久久久久久潘金莲| 在线中文字幕日韩| 性欧美亚洲xxxx乳在线观看| 精品美女国产在线| 国模私拍视频一区| 亚洲国产成人精品电影| 日韩一中文字幕| 国产日产欧美a一级在线| 精品国产乱码久久久久久婷婷| 国产一区二区三区丝袜| 亚洲成人精品视频在线观看| 国产视频综合在线| 欧美色视频日本版| 欧美一区二区三区四区在线| 亚洲视频网站在线观看| 亚洲色图激情小说| 日韩的一区二区| 91国产精品视频在线| 国产69久久精品成人| 69久久夜色精品国产69乱青草| 国产精品久久久久久久久影视| 欧美一级黄色网| 91美女片黄在线观看游戏| 5252色成人免费视频| 欧美成aaa人片在线观看蜜臀| 日韩国产在线看| 欧美成人午夜激情| 91久久中文字幕| 国产视频一区在线| 中文字幕一区二区三区电影| 亚洲香蕉成人av网站在线观看| 日韩亚洲欧美中文高清在线| 97精品国产97久久久久久春色| 正在播放亚洲1区| 亚洲一区二区三区sesese| 久久99热精品这里久久精品| 久久综合久久88| 成人激情综合网| 精品久久中文字幕久久av| 日韩亚洲国产中文字幕| 亚洲人成绝费网站色www| 久久久国产视频91| 欧美电影免费观看大全| 欧美亚洲激情在线| 黄色成人在线免费| 色综合视频一区中文字幕| 久久久久免费精品国产| 亚洲理论片在线观看|