| %REM |
| /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| Run-Time Requirements |
| |
| WMI is preinstalled in Windows Server 2003, Windows XP, Windows Me, and Windows 2000. |
| |
| Windows NT Workstation 4.0 SP4 and later: |
| WMI is available through "Add/Remove Windows components" in Control Panel, as WBEM option install. |
| A later, more comprehensive, version is available as an Internet |
| download from http://www.microsoft.com/downloads. |
| See "WMI CORE 1.5 (Windows 95/98/NT 4.0)". |
| |
| Windows 98/95: |
| WMI CORE 1.5 (Windows 95/98/NT 4.0) is available as an Internet download from |
| http://www.microsoft.com/downloads. |
| |
| This download requires Microsoft Internet Explorer version 5 or later. |
| |
| /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| %END REM |
| Option Public |
| Option Declare |
| |
| %REM |
| /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| Version 1.0, Ulrich Krause, http://www.eknori.de |
| |
| Supported Platforms: |
| ---------------------------------------------------- |
| Windows Server 2003 |
| Windows XP |
| Windows 2000 |
| Windows NT 4.0 |
| Windows 98 |
| |
| http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_diskdrive.asp |
| |
| The Win32_DiskDrive WMI class represents a physical disk drive as seen by a computer running the Windows operating system. |
| Any interface to a Windows 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 a member of this class. |
| |
| /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| %END REM |
| Class HDD |
| Private varHDD_HEADS As Variant |
| Private varHDD_SECTOR As Variant |
| Private varHDD_TRACKS As Variant |
| Private varHDD_CYLINDER As Variant |
| Private varHDD_SIZE As Variant |
| Private varHDD_NAME As Variant |
| Private varHDD_TRACKSPERCYLINDER As Variant |
| Private varHDD_PARTITIONS As Variant |
| Private varHDD_MODEL As Variant |
| |
| Private HDD_MANUFACTURER As String |
| |
| Private HDD_TOTAL_NUMBERS As Integer |
| |
| Private WMIService As Variant |
| Private colHDDDrives As Variant |
| |
| Public Sub New ( computer As String ) |
| HDD_TOTAL_NUMBERS = 0 |
| |
| If computer = "" Or Ucase(computer) = "LOCALHOST" Then computer = "." |
| |
| Set WMIService = GetObject("winmgmts:\\" & Computer & "\root\cimv2") |
| Set colHDDDrives = WMIService.ExecQuery("Select * from Win32_DISKDrive",,48) |
| |
| Forall HDD In colHDDDrives |
| |
| Redim Preserve HDD_MODEL ( HDD_TOTAL_NUMBERS ) As String |
| HDD_MODEL ( HDD_TOTAL_NUMBERS ) = HDD.Model |
| |
| Redim Preserve HDD_PARTITIONS ( HDD_TOTAL_NUMBERS ) As String |
| HDD_PARTITIONS ( HDD_TOTAL_NUMBERS ) = HDD.Partitions |
| |
| Redim Preserve HDD_CYLINDER ( HDD_TOTAL_NUMBERS ) As String |
| HDD_CYLINDER ( HDD_TOTAL_NUMBERS ) = HDD.TotalCylinders |
| |
| Redim Preserve HDD_HEADS ( HDD_TOTAL_NUMBERS ) As String |
| HDD_HEADS ( HDD_TOTAL_NUMBERS ) = HDD.TotalHeads |
| |
| Redim Preserve HDD_SECTOR ( HDD_TOTAL_NUMBERS ) As String |
| HDD_SECTOR ( HDD_TOTAL_NUMBERS ) = HDD.TotalSectors |
| |
| Redim Preserve HDD_TRACKS ( HDD_TOTAL_NUMBERS ) As String |
| HDD_TRACKS ( HDD_TOTAL_NUMBERS ) = HDD.TotalTracks |
| |
| Redim Preserve HDD_TRACKSPERCYLINDER ( HDD_TOTAL_NUMBERS ) As String |
| HDD_TRACKSPERCYLINDER ( HDD_TOTAL_NUMBERS ) = HDD.TracksPerCylinder |
| |
| Redim Preserve HDD_NAME ( HDD_TOTAL_NUMBERS ) As String |
| HDD_NAME ( HDD_TOTAL_NUMBERS ) = HDD.Name |
| |
| Redim Preserve HDD_SIZE ( HDD_TOTAL_NUMBERS ) As String |
| HDD_SIZE ( HDD_TOTAL_NUMBERS ) = HDD.Size |
| |
| HDD_TOTAL_NUMBERS = HDD_TOTAL_NUMBERS + 1 |
| |
| End Forall |
| varHDD_MODEL = HDD_MODEL |
| varHDD_SIZE = HDD_SIZE |
| varHDD_NAME = HDD_NAME |
| varHDD_CYLINDER = HDD_CYLINDER |
| varHDD_HEADS = HDD_HEADS |
| varHDD_SECTOR = HDD_SECTOR |
| varHDD_TRACKS = HDD_TRACKS |
| varHDD_TRACKSPERCYLINDER = HDD_TRACKSPERCYLINDER |
| varHDD_PARTITIONS = HDD_PARTITIONS |
| End Sub |
| |
| Public Property Get MODEL ( i As Integer ) As String |
| %REM |
| Manufacturer's model number of the disk drive. |
| %END REM |
| MODEL = varHDD_MODEL (i) |
| End Property |
| |
| Public Property Get PARTITIONS ( i As Integer ) As Integer |
| %REM |
| Number of partitions on this physical disk drive that are recognized by the operating system. |
| %END REM |
| PARTITIONS = varHDD_PARTITIONS (i) |
| End Property |
| |
| Public Property Get CYLINDER ( i As Integer ) As String |
| %REM |
| Total number of cylinders on the physical disk drive. |
| Note: the value for this property is obtained through extended functions of BIOS interrupt 13h. |
| The value may be inaccurate if the drive uses a translation scheme to support high capacity disk sizes. |
| Consult the manufacturer for accurate drive specifications. |
| %END REM |
| CYLINDER = varHDD_CYLINDER (i) |
| End Property |
| |
| Public Property Get HEADS ( i As Integer ) As String |
| %REM |
| Total number of heads on the disk drive. |
| Note: the value for this property is obtained through extended functions of BIOS interrupt 13h. |
| The value may be inaccurate if the drive uses a translation scheme to support high capacity disk sizes. |
| Consult the manufacturer for accurate drive specifications. |
| %END REM |
| HEADS = varHDD_HEADS (i) |
| End Property |
| |
| Public Property Get SECTOR ( i As Integer ) As String |
| %REM |
| Total number of sectors on the disk drive. |
| Note: the value for this property is obtained through extended functions of BIOS interrupt 13h. |
| The value may be inaccurate if the drive uses a translation scheme to support high capacity disk sizes. |
| Consult the manufacturer for accurate drive specifications. |
| %END REM |
| SECTOR = varHDD_SECTOR (i) |
| End Property |
| |
| Public Property Get TRACKS ( i As Integer ) As String |
| %REM |
| Total number of tracks on the disk drive. |
| Note: the value for this property is obtained through extended functions of BIOS interrupt 13h. |
| The value may be inaccurate if the drive uses a translation scheme to support high capacity disk sizes. |
| Consult the manufacturer for accurate drive specifications. |
| %END REM |
| TRACKS = varHDD_TRACKS (i) |
| End Property |
| |
| Public Property Get TRACKSPERCYLINDER ( i As Integer ) As String |
| %REM |
| Number of tracks in each cylinder on the physical disk drive. |
| Note: the value for this property is obtained through extended functions of BIOS interrupt 13h. |
| The value may be inaccurate if the drive uses a translation scheme to support high capacity disk sizes. |
| Consult the manufacturer for accurate drive specifications. |
| %END REM |
| TRACKSPERCYLINDER = varHDD_TRACKSPERCYLINDER (i) |
| End Property |
| |
| Public Property Get HDDNAME ( i As Integer ) As String |
| %REM |
| Label by which the object is known. When subclassed, the property can be overridden to be a key property. |
| This property is inherited from CIM_ManagedSystemElement. |
| %END REM |
| HDDNAME = varHDD_NAME (i) |
| End Property |
| |
| Public Property Get SIZE ( i As Integer ) As Double |
| %REM |
| Size of the disk drive. |
| It is calculated by multiplying the total number of cylinders, tracks in each cylinder, sectors in each track, |
| and bytes in each sector. |
| %END REM |
| SIZE = varHDD_SIZE (i) |
| End Property |
| |
| Public Property Get TOTALNUMBERS As Integer |
| %REM |
| Total number of disk drives installed on the system |
| %END REM |
| TOTALNUMBERS = HDD_TOTAL_NUMBERS |
| End Property |
| |
| End Class |