PowerShell for Windows Admins

Aug 7 2011   9:26AM GMT

MSDiskDriver classes

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

The root\wmi namespace contains four MSDiskDriver related classes

gwmi -Namespace root\wmi -Class msdiskdriver* -List | select name

MSDiskDriver
MSDiskDriver_Performance
MSDiskDriver_PerformanceData
MSDiskDriver_Geometry

 

The first class – MSDiskDriver – is a super class that calls the other three. Documentation appears to be almost non-existent (there are references to an older copy of the WMI SDK but that doesn’t seem to be available. The MSDiskDriver_PerformanceData class is referenced from the

MSDiskDriver_Performance class as the Perfdata property. We will ignore the  MSDiskDriver class and start with the disk geometry

 

function get-msdiskdrivergeometry  {           
[CmdletBinding()]           
param (           
[string]$computer="."           
)           
BEGIN{           
Add-Type @"
public enum MediaType : int {
Unknown = 0,
RemovableDisk = 11,
HardDisk = 12
}
"@
           
}           
PROCESS{           
Get-WmiObject -Namespace root\wmi -Class msdiskdriver_geometry `
-ComputerName $computer | select InstanceName, Active,            
@{N="DiskType"; E={[mediatype]($($_.MediaType))}},           
Cylinders, TracksPerCylinder, SectorsPerTrack, BytesPerSector           
}           
}

Define an enumeration for the media types – values 1-10 and 13-22 related to floppy or similar devices

use Get-WmiObject to get the object and display – use the enum to decode the media type

On my machine this produces

InstanceName      : IDE\DiskST9250320AS_____________________________HP07____\5&b0fd174&0&1.0.0_0
Active            : True
DiskType          : HardDisk
Cylinders         : 30401
TracksPerCylinder : 255
SectorsPerTrack   : 63
BytesPerSector    : 512

 

compare with the results of Win32_DiskDrive

Get-WmiObject Win32_DiskDrive | select PNPDeviceID, Status, MediaType, TotalCylinders,
TracksPerCylinder, SectorsPerTrack, BytesPerSector

PNPDeviceID       : IDE\DISKST9250320AS_____________________________HP07____\5&B0FD174&0&1.0.0
Status            : OK
MediaType         : Fixed hard disk media
TotalCylinders    : 30401
TracksPerCylinder : 255
SectorsPerTrack   : 63
BytesPerSector    : 512

 Comment on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: