Searching for WMI classes

Working with WMI can be difficult if I don’t know what I am looking for exactly. Most of the time I know the management entity I am interested in but not the WMI class that can provide this management information.

It is easy to discover the classes in powershell V2 knowing just the management entity.

I am interested in knowing about the disks on my machine but don’t seem to remember the class.

I know that all the classes start with “win32_”.

Get-WMIObject –List –namespace “root” –class “win32_*disk*”

No luck so far.

May be it is not in the root namespace. How do I figure out which namespace can provide this information?

 

PS C:\Windows\System32> Get-WMIObject -List -namespace "root" -class "win32_*disk*" -recurse

 

 

  NameSpace: ROOT\CIMV2

Name Methods Properties

---- ------- ----------

Win32_LogicalDisk {SetPowerState, R... {Access, Availability, BlockSize, Caption...}

Win32_MappedLogicalDisk {SetPowerState, R... {Access, Availability, BlockSize, Caption...}

Win32_DiskPartition {SetPowerState, R... {Access, Availability, BlockSize, Bootable...}

Win32_DiskDrive {SetPowerState, R... {Availability, BytesPerSector, Capabilities, CapabilityDesc...

Win32_LogicalDiskRootDirectory {} {GroupComponent, PartComponent}

Win32_DiskQuota {} {DiskSpaceUsed, Limit, QuotaVolume, Status...}

Win32_LogonSessionMappedDisk {} {Antecedent, Dependent}

Win32_LogicalDiskToPartition {} {Antecedent, Dependent, EndingAddress, StartingAddress}

Win32_DiskDrivePhysicalMedia {} {Antecedent, Dependent}

Win32_DiskDriveToDiskPartition {} {Antecedent, Dependent}

Win32_PerfFormattedData_PerfDisk... {} {AvgDiskBytesPerRead, AvgDiskBytesPerTransfer, AvgDiskBytes...

Win32_PerfRawData_PerfDisk_Logic... {} {AvgDiskBytesPerRead, AvgDiskBytesPerRead_Base, AvgDiskByte...

Win32_PerfFormattedData_PerfDisk... {} {AvgDiskBytesPerRead, AvgDiskBytesPerTransfer, AvgDiskBytes...

Win32_PerfRawData_PerfDisk_Physi... {} {AvgDiskBytesPerRead, AvgDiskBytesPerRead_Base, AvgDiskByte...

 

Here it goes. Of course it is disk drives I am interested in and most appropriate class seems to be Win32_DiskDrive. How would I confirm if it is the same class I was interested in?

Let us check the description of this class.

$c = gwmi -query " select * from meta_class where __class='win32_diskdrive'" –amended

$c.psbase.Qualifiers["Description"].Value

 

The Win32_DiskDrive class represents a physical disk drive as seen by a computer running the Win32 operating system.

Any interface to a Win32 physical disk drive is a descendent (or member) of this class.

The features of the disk drive seen through this object correspond to the logical and management characteristics of the drive.

In some cases, this may not reflect the actual physical characteristics of the device. Any object based on another logical device would not be amember of this class.

Example: IDE Fixed Disk.

 

That is a hit.

 

 

Nitin Gupta [MSFT]