WMI获取系统硬件信息.docx

上传人:b****8 文档编号:23812616 上传时间:2023-05-21 格式:DOCX 页数:16 大小:19.29KB
下载 相关 举报
WMI获取系统硬件信息.docx_第1页
第1页 / 共16页
WMI获取系统硬件信息.docx_第2页
第2页 / 共16页
WMI获取系统硬件信息.docx_第3页
第3页 / 共16页
WMI获取系统硬件信息.docx_第4页
第4页 / 共16页
WMI获取系统硬件信息.docx_第5页
第5页 / 共16页
点击查看更多>>
下载资源
资源描述

WMI获取系统硬件信息.docx

《WMI获取系统硬件信息.docx》由会员分享,可在线阅读,更多相关《WMI获取系统硬件信息.docx(16页珍藏版)》请在冰豆网上搜索。

WMI获取系统硬件信息.docx

WMI获取系统硬件信息

WMI是英文WindowsManagementInstrumentation的简写,它的功能主要是:

访问本地主机的一些信息和服务,可以管理远程计算机(当然你必须要拥有足够的权限),比如:

重启,关机,关闭进程,创建进程等。

实例如下:

'用WMI,先工程-引用MicrosoftWMIScriptingV1.1Library

获取显卡/声卡/内存/操作系统的信息

声卡信息

PrivateSubwmiSoundDeviceInfo()

DimwmiObjSetAsSWbemObjectSet

DimobjAsSWbemObject

SetwmiObjSet=GetObject("winmgmts:

{impersonationLevel=impersonate}")._

InstancesOf("Win32_SoundDevice")

OnLocalErrorResumeNext

ForEachobjInwmiObjSet

MsgBoxobj.ProductName

Next

EndSub

显卡信息

PrivateSubwmiVideoControllerInfo()

DimwmiObjSetAsSWbemObjectSet

DimobjAsSWbemObject

SetwmiObjSet=GetObject("winmgmts:

{impersonationLevel=impersonate}")._

InstancesOf("Win32_VideoController")

OnLocalErrorResumeNext

ForEachobjInwmiObjSet

MsgBoxobj.VideoProcessor

Next

EndSub

内存信息

PrivateSubwmiPhysicalMemoryInfo()

DimwmiObjSetAsSWbemObjectSet

DimobjAsSWbemObject

SetwmiObjSet=GetObject("winmgmts:

{impersonationLevel=impersonate}")._

InstancesOf("Win32_PhysicalMemory")

OnLocalErrorResumeNext

ForEachobjItemInwmiObjSet

Debug.Print"BankLabel:

"&objItem.BankLabel

Debug.Print"Capacity:

"&objItem.Capacity

Debug.Print"Caption:

"&objItem.Caption

Debug.Print"CreationClassName:

"&objItem.CreationClassName

Debug.Print"DataWidth:

"&objItem.DataWidth

Debug.Print"Description:

"&objItem.Description

Debug.Print"DeviceLocator:

"&objItem.DeviceLocator

Debug.Print"FormFactor:

"&objItem.FormFactor

Debug.Print"HotSwappable:

"&objItem.HotSwappable

Debug.Print"InstallDate:

"&objItem.InstallDate

Debug.Print"InterleaveDataDepth:

"&objItem.InterleaveDataDepth

Debug.Print"InterleavePosition:

"&objItem.InterleavePosition

Debug.Print"Manufacturer:

"&objItem.Manufacturer

Debug.Print"MemoryType:

"&objItem.MemoryType

Debug.Print"Model:

"&objItem.Model

Debug.Print"Name:

"&objItem.name

Debug.Print"OtherIdentifyingInfo:

"&objItem.OtherIdentifyingInfo

Debug.Print"PartNumber:

"&objItem.PartNumber

Debug.Print"PositionInRow:

"&objItem.PositionInRow

Debug.Print"PoweredOn:

"&objItem.PoweredOn

Debug.Print"Removable:

"&objItem.Removable

Debug.Print"Replaceable:

"&objItem.Replaceable

Debug.Print"SerialNumber:

"&objItem.SerialNumber

Debug.Print"SKU:

"&objItem.SKU

Debug.Print"Speed:

"&objItem.Speed

Debug.Print"Status:

"&objItem.Status

Debug.Print"Tag:

"&objItem.Tag

Debug.Print"TotalWidth:

"&objItem.TotalWidth

Debug.Print"TypeDetail:

"&objItem.TypeDetail

Debug.Print"Version:

"&objItem.Version

Next

EndSub

操作系统信息

PrivateSubCommand1_Click()

DimwmiObjSetAsSWbemObjectSet

DimobjAsSWbemObject

DimmsgAsString

DimdtbAsString

DimdAsString

DimtAsString

DimbiasAsLong

OnLocalErrorResumeNext

SetwmiObjSet=GetObject("winmgmts:

{impersonationLevel=impersonate}").InstancesOf("Win32_OperatingSystem")

ForEachobjInwmiObjSet

MsgBox"你当前使用的系统是"&obj.Caption

Next

EndSub

说明:

大家可能会发现一个规律,实际上WMI对信息的提取都是使用了WIN32_类库名这样的规律,下列表格就是微软的操作系统各种硬件类的描述

其它WMI管理的类的信息在

可以找到,其中也还有部分示例代码

简单Win_32类表

Win32Classes

Microsoft?

Windows?

classesgiveyouthemeanstomanipulateavarietyofobjects.ThefollowingtableidentifiesthecategoriesofWindowsclasses.

CategoryDescription

ComputersystemhardwareClassesthatrepresenthardwarerelatedobjects.

OperatingsystemClassesthatrepresentoperatingsystemrelatedobjects.

InstalledapplicationsClassesthatrepresentsoftwarerelatedobjects.

WMIservicemanagementClassesusedtomanageWMI.

PerformancecountersClassesthatrepresentformattedandrawperformancedata.

硬件类

ComputerSystemHardwareClasses

heCoolingDevicessubcategorygroupsclassesthatrepresentinstrumentablefans,temperatureprobes,andrefrigerationdevices.

ClassDescription

Win32_FanRepresentsthepropertiesofafandeviceinthecomputersystem.

Win32_HeatPipeRepresentsthepropertiesofaheatpipecoolingdevice.

Win32_RefrigerationRepresentsthepropertiesofarefrigerationdevice.

Win32_TemperatureProbeRepresentsthepropertiesofatemperaturesensor(electronicthermometer).

InputDeviceClasses

TheInputDevicessubcategorygroupsclassesthatrepresentkeyboardsandpointingdevices.

ClassDescription

Win32_KeyboardRepresentsakeyboardinstalledonaWindowssystem.

Win32_PointingDeviceRepresentsaninputdeviceusedtopointtoandselectregionsonthedisplayofaWindowscomputersystem.

MassStorageClasses

ClassesintheMassStoragesubcategoryrepresentstoragedevicessuchasharddiskdrives,CD-ROMdrives,andtapedrives.

ClassDescription

Win32_AutochkSettingRepresentsthesettingsfortheautocheckoperationofadisk.

Win32_CDROMDriveRepresentsaCD-ROMdriveonaWindowscomputersystem.

Win32_DiskDriveRepresentsaphysicaldiskdriveasseenbyacomputerrunningtheWindowsoperatingsystem.

Win32_FloppyDriveManagesthecapabilitiesofafloppydiskdrive.

Win32_PhysicalMediaRepresentsanytypeofdocumentationorstoragemedium.

Win32_TapeDriveRepresentsatapedriveonaWindowscomputer.

Motherboard,Controller,andPortClasses

TheMotherboard,Controllers,andPortssubcategorygroupsclassesthatrepresentsystemdevices.Examplesincludesystemmemory,cachememory,andcontrollers.

ClassDescription

Win32_1394ControllerRepresentsthecapabilitiesandmanagementofa1394controller.

Win32_1394ControllerDeviceRelatesthehigh-speedserialbus(IEEE1394Firewire)ControllerandtheCIM_LogicalDeviceinstanceconnectedtoit.

Win32_AllocatedResourceRelatesalogicaldevicetoasystemresource.

Win32_AssociatedProcessorMemoryRelatesaprocessoranditscachememory.

Win32_BaseBoardRepresentsabaseboard(alsoknownasamotherboardorsystemboard).

Win32_BIOSRepresentstheattributesofthecomputersystem'sbasicinput/outputservices(BIOS)thatareinstalledonthecomputer.

Win32_BusRepresentsaphysicalbusasseenbyaWindowsoperatingsystem.

Win32_CacheMemoryRepresentscachememory(internalandexternal)onacomputersystem.

Win32_ControllerHasHubRepresentsthehubsdownstreamfromtheuniversalserialbus(USB)controller.

Win32_DeviceBusRelatesasystembusandalogicaldeviceusingthebus.

Win32_DeviceMemoryAddressRepresentsadevicememoryaddressonaWindowssystem.

Win32_DeviceSettingsRelatesalogicaldeviceandasettingthatcanbeappliedtoit.

Win32_DMAChannelRepresentsadirectmemoryaccess(DMA)channelonaWindowscomputersystem.

Win32_FloppyControllerRepresentsthecapabilitiesandmanagementcapacityofafloppydiskdrivecontroller.

Win32_IDEControllerRepresentsthecapabilitiesofanIntegratedDriveElectronics(IDE)controllerdevice.

Win32_IDEControllerDeviceAssociationclassthatrelatesanIDEcontrollerandthelogicaldevice.

Win32_InfraredDeviceRepresentsthecapabilitiesandmanagementofaninfrareddevice.

Win32_IRQResourceRepresentsaninterruptrequestline(IRQ)numberonaWindowscomputersystem.

Win32_MemoryArrayRepresentsthepropertiesofthecomputersystemmemoryarrayandmappedaddresses.

Win32_MemoryArrayLocationRelatesalogicalmemoryarrayandthephysicalmemoryarrayuponwhichitexists.

Win32_MemoryDeviceRepresentsthepropertiesofacomputersystem'smemorydevicealongwithit'sassociatedmappedaddresses.

Win32_MemoryDeviceArrayRelatesamemorydeviceandthememoryarrayinwhichitresides.

Win32_MemoryDeviceLocationAssociationclassthatrelatesamemorydeviceandthephysicalmemoryonwhichitexists.

Win32_MotherboardDeviceRepresentsadevicethatcontainsthecentralcomponentsoftheWindowscomputersystem.

Win32_OnBoardDeviceRepresentscommonadapterdevicesbuiltintothemotherboard(systemboard).

Win32_ParallelPortRepresentsthepropertiesofaparallelportonaWindowscomputersystem.

Win32_PCMCIAControllerManagesthecapabilitiesofaPersonalComputerMemoryCardInterfaceAdapter(PCMCIA)controllerdevice.

Win32_PhysicalMemoryRepresentsaphysicalmemorydevicelocatedonacomputerasavailabletotheoperatingsystem.

Win32_PhysicalMemoryArrayRepresentsdetailsaboutthecomputersystem'sphysicalmemory.

Win32_PhysicalMemoryLocationRelatesanarrayofphysicalmemoryanditsphysicalmemory.

Win32_PNPAllocatedResourceRepresentsanassociationbetweenlogicaldevicesandsystemresources.

Win32_PNPDeviceRelatesadevice(knowntoConfigurationManagerasaPNPEntity),andthefunctionitperforms.

Win32_PNPEntityRepresentsthepropertiesofaPlugandPlaydevice.

Win32_PortConnectorRepresentsphysicalconnectionports,suchasDB-25pinmale,Centronics,andPS/2.

Win32_PortResourceRepresentsanI/OportonaWindowscomputersystem.

Win32_ProcessorRepresentsadevicecapableofinterpretingasequenceofmachineinstructionsonaWindowscomputersystem.

Win32_SCSIControllerRepresentsasmallcomputersysteminterface(SCSI)controlleronaWindowssystem.

Win32_SCSIControllerDeviceRelatesaSCSIcontrollerandthelogicaldevice(diskdrive)connectedtoit.

Win32_SerialPortRepresentsaserialportonaWindowssystem.

Win32_SerialPortConfigurationRepresentsthesettingsfordatatransmissiononaWindowsserialport.

Win32_SerialPortSettingRelatesaserialportanditsconfigurationsettings.

Win32_SMBIOSMemoryRepresentsthecapabilitiesandmanagementofmemory-relatedlogicaldevices.

Win32_SoundDeviceRepresentsthepropertiesofasounddeviceonaWindowscomputersystem.

Win32_SystemBIOSRelatesacomputersystem(includingdatasuchasstartupproperties,timezones,bootconfigurations,oradministrativepasswords)andasystemBIOS(services,languages,systemmanagementproperties).

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 工程科技 > 纺织轻工业

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1