首页 > 其他分享> > 基于WMI获取USB设备信息(即获取插即用设备信息)System.Management.ManagementObjectSearcher--ManagementObjectCollection
基于WMI获取USB设备信息(即获取插即用设备信息)System.Management.ManagementObjectSearcher--ManagementObjectCollection
作者:互联网
基于WMI获取USB设备信息(即获取插即用设备信息)System.Management.ManagementObjectSearcher--ManagementObjectCollection
获取PC上的设备信息
#region UsbHelper
public static void TestUsbDevice()
{
ushort ProductID = 0xE002, VendorID = 0x0471;
PnPEntityInfo[] UsbDevices = UsbHelper.WhoUsbDevice(VendorID, ProductID);
foreach (var item in UsbDevices)
{
Console.WriteLine($"{item}");
}
}
/// <summary>
/// 即插即用设备信息结构
/// </summary>
public struct PnPEntityInfo
{
public string PNPDeviceID; // 设备ID
public string Name; // 设备名称
public string Description; // 设备描述
public string Service; // 服务
public string Status; // 设备状态
public ushort VendorID; // 供应商标识
public ushort ProductID; // 产品编号
public Guid ClassGuid; // 设备安装类GUID
}
/// <summary>
/// 基于WMI获取USB设备信息
/// </summary>
public partial class UsbHelper
{
#region UsbDevice
/// <summary>
/// 获取所有的USB设备实体(过滤没有VID和PID的设备)
/// </summary>
public static PnPEntityInfo[] AllUsbDevices
{
get
{
return WhoUsbDevice(ushort.MinValue, ushort.MinValue, Guid.Empty);
}
}
/// <summary>
/// 查询USB设备实体(设备要求有VID和PID)
/// </summary>
/// <param name="VendorID">供应商标识,MinValue忽视</param>
/// <param name="ProductID">产品编号,MinValue忽视</param>
/// <param name="ClassGuid">设备安装类Guid,Empty忽视</param>
/// <returns>设备列表</returns>
public static PnPEntityInfo[] WhoUsbDevice(ushort VendorID, ushort ProductID, Guid ClassGuid)
{
List<PnPEntityInfo> UsbDevices = new List<PnPEntityInfo>();
ManagementObjectCollection PnPEntityCollections = new ManagementObjectSearcher("SELECT * FROM Win32_PnPEntity").Get();
if (PnPEntityCollections != null)
{
foreach (ManagementObject Entity in PnPEntityCollections)
{
Console.WriteLine($"{Entity}");
}
}
ManagementObjectCollection USBControllerDeviceCollections = new ManagementObjectSearcher("SELECT * FROM Win32_USBControllerDevice").Get();
if (USBControllerDeviceCollections != null)
{
var d = USBControllerDeviceCollections.OfType<ManagementObject>();
foreach (ManagementObject USBControllerDevice in USBControllerDeviceCollections)
{
Console.WriteLine($"{USBControllerDevice}");
}
}
// 获取USB控制器及其相关联的设备实体
ManagementObjectCollection USBControllerDeviceCollection = new ManagementObjectSearcher("SELECT * FROM Win32_USBControllerDevice").Get();
if (USBControllerDeviceCollection != null)
{
var d = USBControllerDeviceCollection.OfType<ManagementObject>();
foreach (ManagementObject USBControllerDevice in USBControllerDeviceCollection)
{
// 获取设备实体的DeviceID
string Dependent = (USBControllerDevice["Dependent"] as string).Split(new char[] { '=' })[1];
// 过滤掉没有VID和PID的USB设备
Match match = Regex.Match(Dependent, "VID_[0-9|A-F]{4}&PID_[0-9|A-F]{4}");
if (match.Success)
{
ushort theVendorID = Convert.ToUInt16(match.Value.Substring(4, 4), 16); // 供应商标识
if (VendorID != ushort.MinValue && VendorID != theVendorID) continue;
ushort theProductID = Convert.ToUInt16(match.Value.Substring(13, 4), 16); // 产品编号
if (ProductID != ushort.MinValue && ProductID != theProductID) continue;
ManagementObjectCollection PnPEntityCollection = new ManagementObjectSearcher("SELECT * FROM Win32_PnPEntity WHERE DeviceID=" + Dependent).Get();
if (PnPEntityCollection != null)
{
foreach (ManagementObject Entity in PnPEntityCollection)
{
Guid theClassGuid = new Guid(Entity["ClassGuid"] as string); // 设备安装类GUID
if (ClassGuid != Guid.Empty && ClassGuid != theClassGuid) continue;
PnPEntityInfo Element;
Element.PNPDeviceID = Entity["PNPDeviceID"] as string; // 设备ID
Element.Name = Entity["Name"] as string; // 设备名称
Element.Description = Entity["Description"] as string; // 设备描述
Element.Service = Entity["Service"] as string; // 服务
Element.Status = Entity["Status"] as string; // 设备状态
Element.VendorID = theVendorID; // 供应商标识
Element.ProductID = theProductID; // 产品编号
Element.ClassGuid = theClassGuid; // 设备安装类GUID
UsbDevices.Add(Element);
}
}
}
}
}
if (UsbDevices.Count == 0) return null; else return UsbDevices.ToArray();
}
/// <summary>
/// 查询USB设备实体(设备要求有VID和PID)
/// </summary>
/// <param name="VendorID">供应商标识,MinValue忽视</param>
/// <param name="ProductID">产品编号,MinValue忽视</param>
/// <returns>设备列表</returns>
public static PnPEntityInfo[] WhoUsbDevice(ushort VendorID, ushort ProductID)
{
return WhoUsbDevice(VendorID, ProductID, Guid.Empty);
}
/// <summary>
/// 查询USB设备实体(设备要求有VID和PID)
/// </summary>
/// <param name="ClassGuid">设备安装类Guid,Empty忽视</param>
/// <returns>设备列表</returns>
public static PnPEntityInfo[] WhoUsbDevice(Guid ClassGuid)
{
return WhoUsbDevice(ushort.MinValue, ushort.MinValue, ClassGuid);
}
/// <summary>
/// 查询USB设备实体(设备要求有VID和PID)
/// </summary>
/// <param name="PNPDeviceID">设备ID,可以是不完整信息</param>
/// <returns>设备列表</returns>
public static PnPEntityInfo[] WhoUsbDevice(string PNPDeviceID)
{
List<PnPEntityInfo> UsbDevices = new List<PnPEntityInfo>();
// 获取USB控制器及其相关联的设备实体
ManagementObjectCollection USBControllerDeviceCollection = new ManagementObjectSearcher("SELECT * FROM Win32_USBControllerDevice").Get();
if (USBControllerDeviceCollection != null)
{
foreach (ManagementObject USBControllerDevice in USBControllerDeviceCollection)
{ // 获取设备实体的DeviceID
string Dependent = (USBControllerDevice["Dependent"] as string).Split(new char[] { '=' })[1];
if (!string.IsNullOrEmpty(PNPDeviceID))
{ // 注意:忽视大小写
if (Dependent.IndexOf(PNPDeviceID, 1, PNPDeviceID.Length - 2, StringComparison.OrdinalIgnoreCase) == -1) continue;
}
// 过滤掉没有VID和PID的USB设备
Match match = Regex.Match(Dependent, "VID_[0-9|A-F]{4}&PID_[0-9|A-F]{4}");
if (match.Success)
{
ManagementObjectCollection PnPEntityCollection = new ManagementObjectSearcher("SELECT * FROM Win32_PnPEntity WHERE DeviceID=" + Dependent).Get();
if (PnPEntityCollection != null)
{
foreach (ManagementObject Entity in PnPEntityCollection)
{
PnPEntityInfo Element;
Element.PNPDeviceID = Entity["PNPDeviceID"] as string; // 设备ID
Element.Name = Entity["Name"] as string; // 设备名称
Element.Description = Entity["Description"] as string; // 设备描述
Element.Service = Entity["Service"] as string; // 服务
Element.Status = Entity["Status"] as string; // 设备状态
Element.VendorID = Convert.ToUInt16(match.Value.Substring(4, 4), 16); // 供应商标识
Element.ProductID = Convert.ToUInt16(match.Value.Substring(13, 4), 16); // 产品编号 // 产品编号
Element.ClassGuid = new Guid(Entity["ClassGuid"] as string); // 设备安装类GUID
UsbDevices.Add(Element);
}
}
}
}
}
if (UsbDevices.Count == 0) return null; else return UsbDevices.ToArray();
}
/// <summary>
/// 根据服务定位USB设备
/// </summary>
/// <param name="ServiceCollection">要查询的服务集合</param>
/// <returns>设备列表</returns>
public static PnPEntityInfo[] WhoUsbDevice(string[] ServiceCollection)
{
if (ServiceCollection == null || ServiceCollection.Length == 0)
return WhoUsbDevice(ushort.MinValue, ushort.MinValue, Guid.Empty);
List<PnPEntityInfo> UsbDevices = new List<PnPEntityInfo>();
// 获取USB控制器及其相关联的设备实体
ManagementObjectCollection USBControllerDeviceCollection = new ManagementObjectSearcher("SELECT * FROM Win32_USBControllerDevice").Get();
if (USBControllerDeviceCollection != null)
{
foreach (ManagementObject USBControllerDevice in USBControllerDeviceCollection)
{ // 获取设备实体的DeviceID
string Dependent = (USBControllerDevice["Dependent"] as string).Split(new char[] { '=' })[1];
// 过滤掉没有VID和PID的USB设备
Match match = Regex.Match(Dependent, "VID_[0-9|A-F]{4}&PID_[0-9|A-F]{4}");
if (match.Success)
{
ManagementObjectCollection PnPEntityCollection = new ManagementObjectSearcher("SELECT * FROM Win32_PnPEntity WHERE DeviceID=" + Dependent).Get();
if (PnPEntityCollection != null)
{
foreach (ManagementObject Entity in PnPEntityCollection)
{
string theService = Entity["Service"] as string; // 服务
if (string.IsNullOrEmpty(theService)) continue;
foreach (string Service in ServiceCollection)
{ // 注意:忽视大小写
if (string.Compare(theService, Service, true) != 0) continue;
PnPEntityInfo Element;
Element.PNPDeviceID = Entity["PNPDeviceID"] as string; // 设备ID
Element.Name = Entity["Name"] as string; // 设备名称
Element.Description = Entity["Description"] as string; // 设备描述
Element.Service = theService; // 服务
Element.Status = Entity["Status"] as string; // 设备状态
Element.VendorID = Convert.ToUInt16(match.Value.Substring(4, 4), 16); // 供应商标识
Element.ProductID = Convert.ToUInt16(match.Value.Substring(13, 4), 16); // 产品编号
Element.ClassGuid = new Guid(Entity["ClassGuid"] as string); // 设备安装类GUID
UsbDevices.Add(Element);
break;
}
}
}
}
}
}
if (UsbDevices.Count == 0) return null; else return UsbDevices.ToArray();
}
#endregion
#region PnPEntity
/// <summary>
/// 所有即插即用设备实体(过滤没有VID和PID的设备)
/// </summary>
public static PnPEntityInfo[] AllPnPEntities
{
get
{
return WhoPnPEntity(ushort.MinValue, ushort.MinValue, Guid.Empty);
}
}
/// <summary>
/// 根据VID和PID及设备安装类GUID定位即插即用设备实体
/// </summary>
/// <param name="VendorID">供应商标识,MinValue忽视</param>
/// <param name="ProductID">产品编号,MinValue忽视</param>
/// <param name="ClassGuid">设备安装类Guid,Empty忽视</param>
/// <returns>设备列表</returns>
/// <remarks>
/// HID:{745a17a0-74d3-11d0-b6fe-00a0c90f57da}
/// Imaging Device:{6bdd1fc6-810f-11d0-bec7-08002be2092f}
/// Keyboard:{4d36e96b-e325-11ce-bfc1-08002be10318}
/// Mouse:{4d36e96f-e325-11ce-bfc1-08002be10318}
/// Network Adapter:{4d36e972-e325-11ce-bfc1-08002be10318}
/// USB:{36fc9e60-c465-11cf-8056-444553540000}
/// </remarks>
public static PnPEntityInfo[] WhoPnPEntity(ushort VendorID, ushort ProductID, Guid ClassGuid)
{
List<PnPEntityInfo> PnPEntities = new List<PnPEntityInfo>();
// 枚举即插即用设备实体
string VIDPID;
if (VendorID == ushort.MinValue)
{
if (ProductID == ushort.MinValue)
VIDPID = "'%VID[_]____&PID[_]____%'";
else
VIDPID = "'%VID[_]____&PID[_]" + ProductID.ToString("X4") + "%'";
}
else
{
if (ProductID == ushort.MinValue)
VIDPID = "'%VID[_]" + VendorID.ToString("X4") + "&PID[_]____%'";
else
VIDPID = "'%VID[_]" + VendorID.ToString("X4") + "&PID[_]" + ProductID.ToString("X4") + "%'";
}
string QueryString;
if (ClassGuid == Guid.Empty)
QueryString = "SELECT * FROM Win32_PnPEntity WHERE PNPDeviceID LIKE" + VIDPID;
else
QueryString = "SELECT * FROM Win32_PnPEntity WHERE PNPDeviceID LIKE" + VIDPID + " AND ClassGuid='" + ClassGuid.ToString("B") + "'";
ManagementObjectCollection PnPEntityCollection = new ManagementObjectSearcher(QueryString).Get();
if (PnPEntityCollection != null)
{
foreach (ManagementObject Entity in PnPEntityCollection)
{
string PNPDeviceID = Entity["PNPDeviceID"] as string;
Match match = Regex.Match(PNPDeviceID, "VID_[0-9|A-F]{4}&PID_[0-9|A-F]{4}");
if (match.Success)
{
PnPEntityInfo Element;
Element.PNPDeviceID = PNPDeviceID; // 设备ID
Element.Name = Entity["Name"] as string; // 设备名称
Element.Description = Entity["Description"] as string; // 设备描述
Element.Service = Entity["Service"] as string; // 服务
Element.Status = Entity["Status"] as string; // 设备状态
Element.VendorID = Convert.ToUInt16(match.Value.Substring(4, 4), 16); // 供应商标识
Element.ProductID = Convert.ToUInt16(match.Value.Substring(13, 4), 16); // 产品编号
Element.ClassGuid = new Guid(Entity["ClassGuid"] as string); // 设备安装类GUID
PnPEntities.Add(Element);
}
}
}
if (PnPEntities.Count == 0) return null; else return PnPEntities.ToArray();
}
/// <summary>
/// 根据VID和PID定位即插即用设备实体
/// </summary>
/// <param name="VendorID">供应商标识,MinValue忽视</param>
/// <param name="ProductID">产品编号,MinValue忽视</param>
/// <returns>设备列表</returns>
public static PnPEntityInfo[] WhoPnPEntity(ushort VendorID, ushort ProductID)
{
return WhoPnPEntity(VendorID, ProductID, Guid.Empty);
}
/// <summary>
/// 根据设备安装类GUID定位即插即用设备实体
/// </summary>
/// <param name="ClassGuid">设备安装类Guid,Empty忽视</param>
/// <returns>设备列表</returns>
public static PnPEntityInfo[] WhoPnPEntity(Guid ClassGuid)
{
return WhoPnPEntity(ushort.MinValue, ushort.MinValue, ClassGuid);
}
/// <summary>
/// 根据设备ID定位设备
/// </summary>
/// <param name="PNPDeviceID">设备ID,可以是不完整信息</param>
/// <returns>设备列表</returns>
/// <remarks>
/// 注意:对于下划线,需要写成“[_]”,否则视为任意字符
/// </remarks>
public static PnPEntityInfo[] WhoPnPEntity(string PNPDeviceID)
{
List<PnPEntityInfo> PnPEntities = new List<PnPEntityInfo>();
// 枚举即插即用设备实体
string QueryString;
if (string.IsNullOrEmpty(PNPDeviceID))
{
QueryString = "SELECT * FROM Win32_PnPEntity WHERE PNPDeviceID LIKE '%VID[_]____&PID[_]____%'";
}
else
{ // LIKE子句中有反斜杠字符将会引发WQL查询异常
QueryString = "SELECT * FROM Win32_PnPEntity WHERE PNPDeviceID LIKE '%" + PNPDeviceID.Replace('\\', '_') + "%'";
}
ManagementObjectCollection PnPEntityCollection = new ManagementObjectSearcher(QueryString).Get();
if (PnPEntityCollection != null)
{
foreach (ManagementObject Entity in PnPEntityCollection)
{
string thePNPDeviceID = Entity["PNPDeviceID"] as string;
Match match = Regex.Match(thePNPDeviceID, "VID_[0-9|A-F]{4}&PID_[0-9|A-F]{4}");
if (match.Success)
{
PnPEntityInfo Element;
Element.PNPDeviceID = thePNPDeviceID; // 设备ID
Element.Name = Entity["Name"] as string; // 设备名称
Element.Description = Entity["Description"] as string; // 设备描述
Element.Service = Entity["Service"] as string; // 服务
Element.Status = Entity["Status"] as string; // 设备状态
Element.VendorID = Convert.ToUInt16(match.Value.Substring(4, 4), 16); // 供应商标识
Element.ProductID = Convert.ToUInt16(match.Value.Substring(13, 4), 16); // 产品编号
Element.ClassGuid = new Guid(Entity["ClassGuid"] as string); // 设备安装类GUID
PnPEntities.Add(Element);
}
}
}
if (PnPEntities.Count == 0) return null; else return PnPEntities.ToArray();
}
/// <summary>
/// 根据服务定位设备
/// </summary>
/// <param name="ServiceCollection">要查询的服务集合,null忽视</param>
/// <returns>设备列表</returns>
/// <remarks>
/// 跟服务相关的类:
/// Win32_SystemDriverPNPEntity
/// Win32_SystemDriver
/// </remarks>
public static PnPEntityInfo[] WhoPnPEntity(string[] ServiceCollection)
{
if (ServiceCollection == null || ServiceCollection.Length == 0)
return WhoPnPEntity(ushort.MinValue, ushort.MinValue, Guid.Empty);
List<PnPEntityInfo> PnPEntities = new List<PnPEntityInfo>();
// 枚举即插即用设备实体
string QueryString = "SELECT * FROM Win32_PnPEntity WHERE PNPDeviceID LIKE '%VID[_]____&PID[_]____%'";
ManagementObjectCollection PnPEntityCollection = new ManagementObjectSearcher(QueryString).Get();
if (PnPEntityCollection != null)
{
foreach (ManagementObject Entity in PnPEntityCollection)
{
string PNPDeviceID = Entity["PNPDeviceID"] as string;
Match match = Regex.Match(PNPDeviceID, "VID_[0-9|A-F]{4}&PID_[0-9|A-F]{4}");
if (match.Success)
{
string theService = Entity["Service"] as string; // 服务
if (string.IsNullOrEmpty(theService)) continue;
foreach (string Service in ServiceCollection)
{ // 注意:忽视大小写
if (string.Compare(theService, Service, true) != 0) continue;
PnPEntityInfo Element;
Element.PNPDeviceID = PNPDeviceID; // 设备ID
Element.Name = Entity["Name"] as string; // 设备名称
Element.Description = Entity["Description"] as string; // 设备描述
Element.Service = theService; // 服务
Element.Status = Entity["Status"] as string; // 设备状态
Element.VendorID = Convert.ToUInt16(match.Value.Substring(4, 4), 16); // 供应商标识
Element.ProductID = Convert.ToUInt16(match.Value.Substring(13, 4), 16); // 产品编号
Element.ClassGuid = new Guid(Entity["ClassGuid"] as string); // 设备安装类GUID
PnPEntities.Add(Element);
break;
}
}
}
}
if (PnPEntities.Count == 0) return null; else return PnPEntities.ToArray();
}
#endregion
}
//public enum HardwareEnum
//{
// // 硬件
// Win32_Processor, // CPU 处理器
// Win32_PhysicalMemory, // 物理内存条
// Win32_Keyboard, // 键盘
// Win32_PointingDevice, // 点输入设备,包括鼠标。
// Win32_FloppyDrive, // 软盘驱动器
// Win32_DiskDrive, // 硬盘驱动器
// Win32_CDROMDrive, // 光盘驱动器
// Win32_BaseBoard, // 主板
// Win32_BIOS, // BIOS 芯片
// Win32_ParallelPort, // 并口
// Win32_SerialPort, // 串口
// Win32_SerialPortConfiguration, // 串口配置
// Win32_SoundDevice, // 多媒体设置,一般指声卡。
// Win32_SystemSlot, // 主板插槽 (ISA & PCI & AGP)
// Win32_USBController, // USB 控制器
// Win32_NetworkAdapter, // 网络适配器
// Win32_NetworkAdapterConfiguration, // 网络适配器设置
// Win32_Printer, // 打印机
// Win32_PrinterConfiguration, // 打印机设置
// Win32_PrintJob, // 打印机任务
// Win32_TCPIPPrinterPort, // 打印机端口
// Win32_POTSModem, // MODEM
// Win32_POTSModemToSerialPort, // MODEM 端口
// Win32_DesktopMonitor, // 显示器
// Win32_DisplayConfiguration, // 显卡
// Win32_DisplayControllerConfiguration, // 显卡设置
// Win32_VideoController, // 显卡细节。
// Win32_VideoSettings, // 显卡支持的显示模式。
// // 操作系统
// Win32_TimeZone, // 时区
// Win32_SystemDriver, // 驱动程序
// Win32_DiskPartition, // 磁盘分区
// Win32_LogicalDisk, // 逻辑磁盘
// Win32_LogicalDiskToPartition, // 逻辑磁盘所在分区及始末位置。
// Win32_LogicalMemoryConfiguration, // 逻辑内存配置
// Win32_PageFile, // 系统页文件信息
// Win32_PageFileSetting, // 页文件设置
// Win32_BootConfiguration, // 系统启动配置
// Win32_ComputerSystem, // 计算机信息简要
// Win32_OperatingSystem, // 操作系统信息
// Win32_StartupCommand, // 系统自动启动程序
// Win32_Service, // 系统安装的服务
// Win32_Group, // 系统管理组
// Win32_GroupUser, // 系统组帐号
// Win32_UserAccount, // 用户帐号
// Win32_Process, // 系统进程
// Win32_Thread, // 系统线程
// Win32_Share, // 共享
// Win32_NetworkClient, // 已安装的网络客户端
// Win32_NetworkProtocol, // 已安装的网络协议
// Win32_PnPEntity, //all device
//}
//如果是设备字符串中存在COM,则保存该字符串,则找到串口名。
//private static string[] GetHarewareInfo(HardwareEnum hardType, string propKey)
//{
// List<string> strs = new List<string>();
// try
// {
// using (ManagementObjectSearcher searcher = new ManagementObjectSearcher("select * from " + hardType))
// {
// var hardInfos = searcher.Get();
// foreach (var hardInfo in hardInfos)
// {
// if (hardInfo.Properties[propKey].Value != null)
// {
// String str = hardInfo.Properties[propKey].Value.ToString();
// if (str.Contains("COM"))
// {
// strs.Add(str);
// }
// }
// }
// }
// return strs.ToArray();
// }
// catch
// {
// //MessageBox.Show("硬件端口查找错误", "程序猿的提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
// return null;
// }
// finally
// {
// strs = null;
// }
//}
#endregion
WMI使用的WIN32_类库名
WMI使用的WIN32_类库名
包括:硬件类、操作系统类、安装应用程序类、WMI服务管理类、性能计数器类
1、硬件类
冷却类别
Win32_Fan--风扇
Win32_HeatPipe--热管
Win32_Refrigeration--致冷
Win32_TemperatureProbe--温度传感
输入设备类别
Win32_Keyboard--键盘
Win32_PointingDevice--指示设备(如鼠标)
大容量存储类别
Win32_AutochkSetting--磁盘自动检查操作设置
Win32_CDROMDrive--光盘驱动器
Win32_DiskDrive--硬盘驱动器
Win32_FloppyDrive--软盘驱动器
Win32_PhysicalMedia--物理媒体
Win32_TapeDrive--磁带驱动器
主板、控制器、端口类别
Win32_1394Controller--1394控制器
Win32_1394ControllerDevice--1394控制器设备
Win32_AllocatedResource--已分配的资源
Win32_AssociatedProcessorMemory--处理器和高速缓冲存储器
Win32_BaseBoard--主板
Win32_BIOS--BIOS(基本输入输出系统)
Win32_Bus--总线
Win32_CacheMemory--缓存内存
Win32_ControllerHasHub--USB控制器
Win32_DeviceBus--设备总线
Win32_DeviceMemoryAddress--设备存储器地址
Win32_DeviceSettings--设备设置
Win32_DMAChannel--DMA通道
Win32_FloppyController--软盘控制器
Win32_IDEController--IDE控制器
Win32_IDEControllerDevice--IDE控制器设备
Win32_InfraredDevice--红外线设备
Win32_IRQResource--中断(IRQ)资源
Win32_MemoryArray--内存数组
Win32_MemoryArrayLocation--内存数组位置
Win32_MemoryDevice--内存设备
Win32_MemoryDeviceArray--内存设备数组
Win32_MemoryDeviceLocation--内存设备位置
Win32_MotherboardDevice--主板设备
Win32_OnBoardDevice--插件设备
Win32_ParallelPort--并行端口
Win32_PCMCIAController--PCMCIA控制器
Win32_PhysicalMemory--物理内存
Win32_PhysicalMemoryArray--物理内存数组
Win32_PhysicalMemoryLocation--物理内存位置
Win32_PNPAllocatedResource--PNP保留资源
Win32_PNPDevice--PNP设备
Win32_PNPEntity--PNP实体
Win32_PortConnector--端口连接器
Win32_PortResource--端口资源
Win32_Processor--(CPU)处理器
Win32_SCSIController--SCSI控制器
Win32_SCSIControllerDevice--SCSI控制器设备
Win32_SerialPort--串行端口
Win32_SerialPortConfiguration--串行端口配置
Win32_SerialPortSetting--串行端口设置
Win32_SMBIOSMemory--内存有关的设备的管理
Win32_SoundDevice--声卡
Win32_SystemBIOS--系统BIOS
Win32_SystemDriverPNPEntity--系统驱动器PNP实体
Win32_SystemEnclosure--系统封闭
Win32_SystemMemoryResource--系统内存资源
Win32_SystemSlot--系统插槽
Win32_USBController--USB控制器
Win32_USBControllerDevice--USB控制器设备
Win32_USBHub--USB集线器
建网设备类别
Win32_NetworkAdapter--网络适配器
Win32_NetworkAdapterConfiguration--网络适配器配置
Win32_NetworkAdapterSetting--网络适配器设置
电源类别
Win32_AssociatedBattery--联合电池组
Win32_Battery--电池
Win32_CurrentProbe--当前传感
Win32_PortableBattery--便携式电池
Win32_PowerManagementEvent--电池事件管理
Win32_UninterruptiblePowerSupply--UPS电源
Win32_VoltageProbe--电压探测
打印类别
Win32_DriverForDevice--驱动器设备
Win32_Printer--打印机
Win32_PrinterConfiguration--打印机配置
Win32_PrinterController--打印机控制器
Win32_PrinterDriver--打印机驱动器
Win32_PrinterDriverDll--打印机驱动器DLL
Win32_PrinterSetting--打印机设置
Win32_PrintJob--打印工作
Win32_TCPIPPrinterPort--TCPIP打印机端口
电话类别
Win32_POTSModem--POTS调制解调器(Modem)
Win32_POTSModemToSerialPort--POTS调制解调器串行端口
视频监视器类别
Win32_DesktopMonitor--即插即用监视器
Win32_DisplayConfiguration--显示配置
Win32_DisplayControllerConfiguration--显示控制器配置
Win32_VideoConfiguration--视频配置
Win32_VideoController--视频控制器
Win32_VideoSettings--视频设置
2、操作系统类
COM类别
Win32_ClassicCOMApplicationClasses--
Win32_ClassicCOMClass--
Win32_ClassicCOMClassSettings--
Win32_ClientApplicationSetting--
Win32_COMApplication--COM应用
Win32_COMApplicationClasses--
Win32_COMApplicationSettings--
Win32_COMClass--
Win32_ComClassAutoEmulator--
Win32_ComClassEmulator--
Win32_ComponentCategory--
Win32_COMSetting--
Win32_DCOMApplication--DCOM应用
Win32_DCOMApplicationAccessAllowedSetting--
Win32_DCOMApplicationSetting--
Win32_ImplementedCategory--
桌面类别
Win32_Desktop--桌面
Win32_Environment--环境
Win32_TimeZone--时区
Win32_UserDesktop--使用者桌面
驱动程序类别
Win32_DriverVXD--
Win32_SystemDriver--系统驱动程序
文件系统类别
Win32_CIMLogicalDeviceCIMDataFile--
Win32_Directory--
Win32_DirectorySpecification--
Win32_DiskDriveToDiskPartition--
Win32_DiskPartition--磁盘逻辑分区
Win32_DiskQuota--NTFS磁盘分区定额
Win32_LogicalDisk--逻辑磁盘分区
Win32_LogicalDiskRootDirectory--
Win32_LogicalDiskToPartition--
Win32_MappedLogicalDisk--映射逻辑磁盘
Win32_OperatingSystemAutochkSetting--
Win32_QuotaSetting--
Win32_ShortcutFile--
Win32_SubDirectory--
Win32_SystemPartitions--
Win32_Volume--
Win32_VolumeQuota--
Win32_VolumeQuotaSetting--
Win32_VolumeUserQuota--
作业对象类别
Win32_CollectionStatistics--
Win32_LUID--
Win32_LUIDandAttributes--
Win32_NamedJobObject--
Win32_NamedJobObjectActgInfo--
Win32_NamedJobObjectLimit--
Win32_NamedJobObjectLimitSetting--
Win32_NamedJobObjectProcess--
Win32_NamedJobObjectSecLimit--
Win32_NamedJobObjectSecLimitSetting--
Win32_NamedJobObjectStatistics--
Win32_SIDandAttributes--
Win32_TokenGroups--
Win32_TokenPrivileges--
存储页面文件类别
Win32_LogicalMemoryConfiguration--逻辑内存配置
Win32_PageFile--页面文件
Win32_PageFileElementSetting--
Win32_PageFileSetting--页面文件设置
Win32_PageFileUsage--页面文件使用
Win32_SystemLogicalMemoryConfiguration--
多媒体视听类别
Win32_CodecFile--编解码器文件
建网类别
Win32_ActiveRoute--活动路由
Win32_IP4PersistedRouteTable--
Win32_IP4RouteTable--路由表
Win32_IP4RouteTableEvent--
Win32_NetworkClient--
Win32_NetworkConnection--
Win32_NetworkProtocol--网络协议
Win32_NTDomain--
Win32_PingStatus--
Win32_ProtocolBinding--协议绑定
操作系统事件类别
Win32_ComputerShutdownEvent--
Win32_ComputerSystemEvent--
Win32_DeviceChangeEvent--
Win32_ModuleLoadTrace--
Win32_ModuleTrace--
Win32_ProcessStartTrace--
Win32_ProcessStopTrace--
Win32_ProcessTrace--
Win32_SystemConfigurationChangeEvent--
Win32_SystemTrace--
Win32_ThreadStartTrace--
Win32_ThreadStopTrace--
Win32_ThreadTrace--
Win32_VolumeChangeEvent--
Win32_BootConfiguration--引导配置
Win32_ComputerSystem--计算机系统
Win32_ComputerSystemProcessor--计算机系统处理器
Win32_ComputerSystemProduct--计算机系统产品
Win32_DependentService--信任的服务
Win32_LoadOrderGroup--装载顺序组
Win32_LoadOrderGroupServiceDependencies--
Win32_LoadOrderGroupServiceMembers--
Win32_OperatingSystem--操作系统
Win32_OperatingSystemQFE--
Win32_OSRecoveryConfiguration--操作系统恢复配置
Win32_QuickFixEngineering--
Win32_StartupCommand--启动命令
Win32_SystemBootConfiguration--
Win32_SystemDesktop--
Win32_SystemDevices--
Win32_SystemLoadOrderGroups--
Win32_SystemNetworkConnections--
Win32_SystemOperatingSystem--
Win32_SystemProcesses--
Win32_SystemProgramGroups--Windows开始程序组
Win32_SystemResources--
Win32_SystemServices--系统服务
Win32_SystemSetting--
Win32_SystemSystemDriver--
Win32_SystemTimeZone--系统时区
Win32_SystemUsers--系统用户
进程类别
Win32_Process--进程
Win32_ProcessStartup--
Win32_Thread--线程
注册类别
Win32_Registry--注册表
调试程序作业类别
Win32_CurrentTime--当前时间
Win32_ScheduledJob--
安全类别
Win32_AccountSID--
Win32_ACE--
Win32_LogicalFileAccess--
Win32_LogicalFileAuditing--
Win32_LogicalFileGroup--
Win32_LogicalFileOwner--
Win32_LogicalFileSecuritySetting--
Win32_LogicalShareAccess--
Win32_LogicalShareAuditing--
Win32_LogicalShareSecuritySetting--
Win32_PrivilegesStatus--
Win32_SecurityDescriptor--
Win32_SecuritySetting--
Win32_SecuritySettingAccess--
Win32_SecuritySettingAuditing--
Win32_SecuritySettingGroup--
Win32_SecuritySettingOfLogicalFile--
Win32_SecuritySettingOfLogicalShare--
Win32_SecuritySettingOfObject--
Win32_SecuritySettingOwner--
Win32_SID--
Win32_Trustee--
服务类别
Win32_BaseService--基本服务
Win32_Service--服务
共享类别
Win32_DFSNode--
Win32_DFSNodeTarget--
Win32_DFSTarget--
Win32_ServerConnection--
Win32_ServerSession--
Win32_ConnectionShare--
Win32_PrinterShare--
Win32_SessionConnection--
Win32_SessionProcess--
Win32_ShareToDirectory--
Win32_Share--共享文件夹
开始菜单类别
Win32_LogicalProgramGroup--Windows开始逻辑程序组
Win32_LogicalProgramGroupDirectory--Windows开始逻辑程序组目录Win32_LogicalProgramGroupItem--Windows开始逻辑程序组项
Win32_LogicalProgramGroupItemDataFile--Windows开始逻辑程序组项数据文件
Win32_ProgramGroup--Windows程序组
Win32_ProgramGroupContents--Windows程序组内容
Win32_ProgramGroupOrItem--Windows程序组或项
存储类别
Win32_ShadowBy--
Win32_ShadowContext--
Win32_ShadowCopy--
Win32_ShadowDiffVolumeSupport--
Win32_ShadowFor--
Win32_ShadowOn--
Win32_ShadowProvider--
Win32_ShadowStorage--
Win32_ShadowVolumeSupport--
Win32_Volume--
Win32_VolumeUserQuota--
用户类别
Win32_Account--帐户
Win32_Group--组
Win32_GroupInDomain--域中的组
Win32_GroupUser--组用户
Win32_LogonSession--登录会话
Win32_LogonSessionMappedDisk--
Win32_NetworkLoginProfile--
Win32_SystemAccount--系统账户
Win32_UserAccount--使用账户
Win32_UserInDomain--域中的用户
Windows NT的事件日志类别
Win32_NTEventlogFile--事件日志文件
Win32_NTLogEvent--日志事件
Win32_NTLogEventComputer--日志事件计算机
Win32_NTLogEventLog--日志事件日志
Win32_NTLogEventUser--
Windows产品激活类别
Win32_ComputerSystemWindowsProductActivationSetting--
Win32_Proxy--代理
Win32_WindowsProductActivation--Windows产品激活
3、安装应用程序类
Win32_ActionCheck--
Win32_ApplicationCommandLine--
Win32_ApplicationService--
Win32_Binary--
Win32_BindImageAction--
Win32_CheckCheck--
Win32_ClassInfoAction--
Win32_CommandLineAccess--
Win32_Condition--
Win32_CreateFolderAction--
Win32_DuplicateFileAction--
Win32_EnvironmentSpecification--
Win32_ExtensionInfoAction--
Win32_FileSpecification--
Win32_FontInfoAction--
Win32_IniFileSpecification--
Win32_InstalledSoftwareElement--
Win32_LaunchCondition--
Win32_ManagedSystemElementResource--
Win32_MIMEInfoAction--
Win32_MoveFileAction--
Win32_MSIResource--
Win32_ODBCAttribute--
Win32_ODBCDataSourceAttribute--
Win32_ODBCDataSourceSpecification--
Win32_ODBCDriverAttribute--
Win32_ODBCDriverSoftwareElement--
Win32_ODBCDriverSpecification--
Win32_ODBCSourceAttribute--
Win32_ODBCTranslatorSpecification--
Win32_Patch--
Win32_PatchFile--
Win32_PatchPackage--
Win32_Product--
Win32_ProductCheck--
Win32_ProductResource--
Win32_ProductSoftwareFeatures--
Win32_ProgIDSpecification--
Win32_Property--
Win32_PublishComponentAction--
Win32_RegistryAction--
Win32_RemoveFileAction--
Win32_RemoveIniAction--
Win32_ReserveCost--
Win32_SelfRegModuleAction--
Win32_ServiceControl--
Win32_ServiceSpecification--
Win32_ServiceSpecificationService--
Win32_SettingCheck--
Win32_ShortcutAction--
Win32_ShortcutSAP--
Win32_SoftwareElement--
Win32_SoftwareElementAction--
Win32_SoftwareElementCheck--
Win32_SoftwareElementCondition--
Win32_SoftwareElementResource--
Win32_SoftwareFeature--
Win32_SoftwareFeatureAction--
Win32_SoftwareFeatureCheck--
Win32_SoftwareFeatureParent--
Win32_SoftwareFeatureSoftwareElements--
Win32_TypeLibraryAction--
4、WMI服务管理类
WMI配置类别
Win32_MethodParameterClass--方法参数类
WMI管理类别
Win32_WMISetting--WMI设置
Win32_WMIElementSetting--WMI单元设置
5、性能计数器类
格式化性能计数器类别
Win32_PerfFormattedData--
Win32_PerfFormattedData_ASP_ActiveServerPages--
Win32_PerfFormattedData_ContentFilter_IndexingServiceFilter--
Win32_PerfFormattedData_ContentIndex_IndexingService--
Win32_PerfFormattedData_InetInfo_InternetInformationServicesGlobal--
Win32_PerfFormattedData_ISAPISearch_HttpIndexingService--
Win32_PerfFormattedData_MSDTC_DistributedTransactionCoordinator--
Win32_PerfFormattedData_NTFSDRV_SMTPNTFSStoreDriver--
Win32_PerfFormattedData_PerfDisk_LogicalDisk--
Win32_PerfFormattedData_PerfDisk_PhysicalDisk--
Win32_PerfFormattedData_PerfNet_Browser--
Win32_PerfFormattedData_PerfNet_Redirector--
Win32_PerfFormattedData_PerfNet_Server--
Win32_PerfFormattedData_PerfNet_ServerWorkQueues--
Win32_PerfFormattedData_PerfOS_Cache--
Win32_PerfFormattedData_PerfOS_Memory--
Win32_PerfFormattedData_PerfOS_Objects--
Win32_PerfFormattedData_PerfOS_PagingFile--
Win32_PerfFormattedData_PerfOS_Processor--
Win32_PerfFormattedData_PerfOS_System--
Win32_PerfFormattedData_PerfProc_FullImage_Costly--
Win32_PerfFormattedData_PerfProc_Image_Costly--Win32_PerfFormattedData_PerfProc_JobObject--Win32_PerfFormattedData_PerfProc_JobObjectDetails--Win32_PerfFormattedData_PerfProc_Process--Win32_PerfFormattedData_PerfProc_ProcessAddressSpace_Costly--Win32_PerfFormattedData_PerfProc_Thread--Win32_PerfFormattedData_PerfProc_ThreadDetails_Costly--Win32_PerfFormattedData_PSched_PSchedFlow--
Win32_PerfFormattedData_PSched_PSchedPipe--Win32_PerfFormattedData_RemoteAccess_RASPort--Win32_PerfFormattedData_RemoteAccess_RASTotal--Win32_PerfFormattedData_RSVP_ACSRSVPInterfaces--Win32_PerfFormattedData_RSVP_ACSRSVPService--Win32_PerfFormattedData_SMTPSVC_SMTPServer--Win32_PerfFormattedData_Spooler_PrintQueue--
Win32_PerfFormattedData_TapiSrv_Telephony--
Win32_PerfFormattedData_Tcpip_ICMP--
Win32_PerfFormattedData_Tcpip_IP--
Win32_PerfFormattedData_Tcpip_NBTConnection--Win32_PerfFormattedData_Tcpip_NetworkInterface--
Win32_PerfFormattedData_Tcpip_TCP--
Win32_PerfFormattedData_Tcpip_UDP--Win32_PerfFormattedData_TermService_TerminalServices--Win32_PerfFormattedData_TermService_TerminalServicesSession--Win32_PerfFormattedData_W3SVC_WebService--
原始性能计数器类别
Win32_PerfRawData--Win32_PerfRawData_ASP_ActiveServerPages--Win32_PerfRawData_ContentFilter_IndexingServiceFilter--Win32_PerfRawData_ContentIndex_IndexingService--Win32_PerfRawData_InetInfo_InternetInformationServicesGlobal--Win32_PerfRawData_ISAPISearch_HttpIndexingService--Win32_PerfRawData_MSDTC_DistributedTransactionCoordinator--Win32_PerfRawData_NTFSDRV_SMTPNTFSStoreDriver--
Win32_PerfRawData_PerfDisk_LogicalDisk--
Win32_PerfRawData_PerfDisk_PhysicalDisk--
Win32_PerfRawData_PerfNet_Browser--
Win32_PerfRawData_PerfNet_Redirector--
Win32_PerfRawData_PerfNet_Server--
Win32_PerfRawData_PerfNet_ServerWorkQueues--
Win32_PerfRawData_PerfOS_Cache--
Win32_PerfRawData_PerfOS_Memory--
Win32_PerfRawData_PerfOS_Objects--
Win32_PerfRawData_PerfOS_PagingFile--
Win32_PerfRawData_PerfOS_Processor--
Win32_PerfRawData_PerfOS_System--
Win32_PerfRawData_PerfProc_FullImage_Costly--
Win32_PerfRawData_PerfProc_Image_Costly--
Win32_PerfRawData_PerfProc_JobObject--
Win32_PerfRawData_PerfProc_JobObjectDetails--
Win32_PerfRawData_PerfProc_Process--Win32_PerfRawData_PerfProc_ProcessAddressSpace_Costly--Win32_PerfRawData_PerfProc_Thread--
Win32_PerfRawData_PerfProc_ThreadDetails_Costly--
Win32_PerfRawData_PSched_PSchedFlow--
Win32_PerfRawData_PSched_PSchedPipe--
Win32_PerfRawData_RemoteAccess_RASPort--
Win32_PerfRawData_RemoteAccess_RASTotal--
Win32_PerfRawData_RSVP_ACSRSVPInterfaces--
Win32_PerfRawData_RSVP_ACSRSVPService--
Win32_PerfRawData_SMTPSVC_SMTPServer--
Win32_PerfRawData_Spooler_PrintQueue--
Win32_PerfRawData_TapiSrv_Telephony--
Win32_PerfRawData_Tcpip_ICMP--
Win32_PerfRawData_Tcpip_IP--
Win32_PerfRawData_Tcpip_NBTConnection--
Win32_PerfRawData_Tcpip_NetworkInterface--
Win32_PerfRawData_Tcpip_TCP--
Win32_PerfRawData_Tcpip_UDP--
Win32_PerfRawData_TermService_TerminalServices--Win32_PerfRawData_TermService_TerminalServicesSession--Win32_PerfRawData_W3SVC_WebService--
标签:Management,USB,--,Element,Win32,获取,PerfRawData,设备,string 来源: https://blog.csdn.net/LongtengGensSupreme/article/details/118491219