Win32_DiskPartition class

The Win32_DiskPartition WMI class represents the capabilities and management capacity of a partitioned area of a physical disk on a computer system running Windows. Example: Disk #0, Partition #1.

The following syntax is simplified from Managed Object Format (MOF) code and includes all of the inherited properties. Properties are listed in alphabetic order, not MOF order.

Syntax

[Dynamic, Provider("CIMWin32"), UUID("{8502C4B8-5FBB-11D2-AAC1-006008C78BC7}"), AMENDMENT]
class Win32_DiskPartition : CIM_DiskPartition
{
  unit16   AdditionalAvailability;
  uint16   Availability;
  uint16   PowerManagementCapabilities[];
  string   IdentifyingDescriptions[1];
  uint64   MaxQuiesceTime;
  uint64   OtherIdentifyingInfo;
  uint16   StatusInfo;
  uint64   PowerOnHours;
  uint64   TotalPowerOnHours;
  uint16   Access;
  uint64   BlockSize;
  boolean  Bootable;
  boolean  BootPartition;
  string.  Caption;
  uint32   ConfigManagerErrorCode;
  boolean  ConfigManagerUserConfig;
  string.  CreationClassName;
  string   Description;
  string   DeviceID;
  uint32   DiskIndex;
  boolean  ErrorCleared;
  string   ErrorDescription;
  string   ErrorMethodology;
  uint32   HiddenSectors;
  uint32   Index;
  datetime InstallDate;
  uint32   LastErrorCode;
  string   Name;
  uint64   NumberOfBlocks;
  string   PNPDeviceID;
  boolean  PowerManagementSupported;
  boolean  PrimaryPartition;
  string   Purpose;
  boolean  RewritePartition;
  uint64   Size;
  uint64   StartingOffset;
  string   Status;
  string   SystemCreationClassName;
  string   SystemName;
  string   Type;
};

Members

The Win32_DiskPartition class has these types of members:

Methods

The Win32_DiskPartition class has these methods.

Method Description
Reset Requests a reset of the logical device.
SetPowerState Sets the desired power state for a logical device and when a device should be put into that state.

Properties

The Win32_DiskPartition class has these properties.

Access

Data type: uint16

Access type: Read-only

Media access available.

This property is inherited from CIM_StorageExtent.

Unknown (0)

Readable (1)

Writeable (2)

Writable

Read/Write Supported (3)

Write Once (4)

AdditionalAvailability

Data type: unit16

Access type: Write-only

Additional availability and status of the Device, beyond that specified in the Availability property. The Availability property denotes the primary status and availability of the Device. In some cases, this will not be sufficient to denote the complete status of the Device. In those cases, the AdditionalAvailability property can be used to provide further information. For example, a Device's primary Availability may be Off line (value=8), but it may also be in a low power state (AdditonalAvailability value=14), or the Device could be running Diagnostics (AdditionalAvailability value=5, In Test)."

This property is inherited from CIM_LogicalDevice.

Other (1)

Unknown (2)

Running/Full Power (3)

Warning (4)

In Test (5)

Not Applicable (6)

Power Off (7)

Off Line (8)

Off Duty (9)

Degraded (10)

Not Installed (11)

Install Error (12)

Power Save - Unknown (13)

Power Save - Low Power Mode (14)

Power Save - Standby (15)

Power Cycle (16)

Power Save - Warning (17)

Paused (18)

Not Ready (19)

Not Configured (20)

Quiesce (21)

Availability

Data type: uint16

Access type: Read-only

Qualifiers: MappingStrings ("MIF.DMTF|Operational State|003.5", "MIB.IETF|HOST-RESOURCES-MIB.hrDeviceStatus")

Availability and status of the device.

This property is inherited from CIM_LogicalDevice.

Other (1)

Unknown (2)

Running/Full Power (3)

Warning (4)

In Test (5)

Not Applicable (6)

Power Off (7)

Off Line (8)

Off Duty (9)

Degraded (10)

Not Installed (11)

Install Error (12)

Power Save - Unknown (13)

The device is known to be in a power save mode, but its exact status is unknown.

Power Save - Low Power Mode (14)

The device is in a power save state but still functioning, and may exhibit degraded performance.

Power Save - Standby (15)

The device is not functioning but could be brought to full power quickly.

Power Cycle (16)

Power Save - Warning (17)

The device is in a warning state, though also in a power save mode.

Paused (18)

The device is paused.

Not Ready (19)

The device is not ready.

Not Configured (20)

The device is not configured.

Quiesced (21)

The device is quiet.

BlockSize

Data type: uint64

Access type: Read-only

Qualifiers: MappingStrings ("MIB.IETF|HOST-RESOURCES-MIB.hrStorageAllocationUnits"), Units ("bytes")

Size in bytes of the blocks which form this storage extent. If unknown or if a block concept is not valid (for example, for aggregate extents, memory or logical disks), enter a 1.

For more information about using uint64 values in scripts, see Scripting in WMI.

This property is inherited from CIM_StorageExtent.

Bootable

Data type: boolean

Access type: Read-only

Indicates whether the computer can be booted from this partition.

This property is inherited from CIM_DiskPartition.

BootPartition

Data type: boolean

Access type: Read-only

Qualifiers: MappingStrings ("Win32API|File Functions|ReadFile")

Partition is the active partition. The operating system uses the active partition when booting from a hard disk.

Caption

Data type: string.

Access type: Read-only

Qualifiers: MaxLen (64), DisplayName ("Caption")

Short description of the object.

This property is inherited from CIM_ManagedSystemElement.

ConfigManagerErrorCode

Data type: uint32

Access type: Read-only

Qualifiers: Schema ("Win32")

Windows Configuration Manager error code.

This property is inherited from CIM_LogicalDevice.

This device is working properly. (0)

Device is working properly.

This device is not configured correctly. (1)

Device is not configured correctly.

Windows cannot load the driver for this device. (2)

The driver for this device might be corrupted, or your system may be running low on memory or other resources. (3)

This device is not working properly. One of its drivers or your registry might be corrupted. (4)

The driver for this device needs a resource that Windows cannot manage. (5)

The boot configuration for this device conflicts with other devices. (6)

Cannot filter. (7)

The driver loader for the device is missing. (8)

This device is not working properly because the controlling firmware is reporting the resources for the device incorrectly. (9)

This device cannot start. (10)

This device failed. (11)

This device cannot find enough free resources that it can use. (12)

Windows cannot verify this device's resources. (13)

This device cannot work properly until you restart your computer. (14)

This device is not working properly because there is probably a re-enumeration problem. (15)

Windows cannot identify all the resources this device uses. (16)

This device is asking for an unknown resource type. (17)

Reinstall the drivers for this device. (18)

Failure using the VxD loader. (19)

Your registry might be corrupted. (20)

System failure: Try changing the driver for this device. If that does not work, see your hardware documentation. Windows is removing this device. (21)

This device is disabled. (22)

System failure: Try changing the driver for this device. If that doesn't work, see your hardware documentation. (23)

This device is not present, is not working properly, or does not have all its drivers installed. (24)

Windows is still setting up this device. (25)

Windows is still setting up this device. (26)

This device does not have valid log configuration. (27)

The drivers for this device are not installed. (28)

This device is disabled because the firmware of the device did not give it the required resources. (29)

This device is using an Interrupt Request (IRQ) resource that another device is using. (30)

This device is not working properly because Windows cannot load the drivers required for this device. (31)

ConfigManagerUserConfig

Data type: boolean

Access type: Read-only

Qualifiers: Schema ("Win32")

If True, the device is using a user-defined configuration.

This property is inherited from CIM_LogicalDevice.

CreationClassName

Data type: string.

Access type: Read-only

Qualifiers: CIM_Key

Name of the first concrete class to appear in the inheritance chain used in the creation of an instance. When used with the other key properties of the class, the property allows all instances of this class and its subclasses to be uniquely identified.

This property is inherited from CIM_LogicalDevice.

Description

Data type: string

Access type: Read-only

Qualifiers: DisplayName ("Description")

Description of the object.

This property is inherited from CIM_ManagedSystemElement.

DeviceID

Data type: string

Access type: Read-only

Qualifiers: Key, Override ("DeviceId"), MappingStrings ("WMI")

Unique identifier of the disk drive and partition, from the rest of the system.

DiskIndex

Data type: uint32

Access type: Read-only

Qualifiers: MappingStrings ("Win32API|File Functions|ReadFile")

Index number of the disk containing this partition.

Example: 0

ErrorCleared

Data type: boolean

Access type: Read-only

If True, the error reported in LastErrorCode is now cleared.

This property is inherited from CIM_LogicalDevice.

ErrorDescription

Data type: string

Access type: Read-only

Information about the error recorded in LastErrorCode, and information on any corrective actions that may be taken.

This property is inherited from CIM_LogicalDevice.

ErrorMethodology

Data type: string

Access type: Read-only

Type of error detection and correction supported by this storage extent.

This property is inherited from CIM_StorageExtent.

HiddenSectors

Data type: uint32

Access type: Read-only

Qualifiers: MappingStrings ("Win32API")

Number of hidden sectors in the partition.

Example: 63

IdentifyingDescriptions

Data type: string array

Access type: Read-only

An array of free-form strings providing explanations and details behind the entries in the OtherIdentifyingInfo array. Note, each entry of this array is related to the entry in OtherIdentifyingInfo that is located at the same index.

This property is inherited from CIM_LogicalDevice.

Index

Data type: uint32

Access type: Read-only

Qualifiers: MappingStrings ("WMI")

Index number of the partition.

Example: 1

InstallDate

Data type: datetime

Access type: Read-only

Qualifiers: MappingStrings ("MIF.DMTF|ComponentID|001.5"), DisplayName ("Install Date")

Date the object was installed. This property does not need a value to indicate that the object is installed.

This property is inherited from CIM_ManagedSystemElement.

LastErrorCode

Data type: uint32

Access type: Read-only

Last error code reported by the logical device.

This property is inherited from CIM_LogicalDevice.

MaxQuiesceTime

Data type: uint64

Access type: Read-only

Qualifiers: Depricated

Maximum time in milliseconds, that a Device can run in a Quiesced state. A Device's state is defined in its Availability and AdditionalAvailability properties, where Quiesced is conveyed by the value 21. What occurs at the end of the time limit is device-specific. The Device may unquiesce, may offline or take other action. A value of 0 indicates that a Device can remain quiesced indefinitely.

Note

"The MaxQuiesceTime property has been deprecated. When evaluating the use of Quiesce, it was determine that this single property is not adequate for describing when a device will automatically exit a quiescent state. In fact, the most likely scenario for a device to exit a quiescent state was determined to be based on the number of outstanding requests queued rather than on a maximum time. This will be re-evaluated and repositioned later. \n

This property is inherited from CIM_LogicalDevice.

Name

Data type: string

Access type: Read-only

Qualifiers: DisplayName ("Name")

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.

NumberOfBlocks

Data type: uint64

Access type: Read-only

Qualifiers: MappingStrings ("MIB.IETF|HOST-RESOURCES-MIB.hrStorageSize")

Total number of consecutive blocks, each block the size of the value contained in the BlockSize property, which form this storage extent. Total size of the storage extent can be calculated by multiplying the value of the BlockSize property by the value of this property. If the value of BlockSize is 1, this property is the total size of the storage extent.

For more information about using uint64 values in scripts, see Scripting in WMI.

This property is inherited from CIM_StorageExtent.

OtherIdentifyingInfo

Data type: uint64

Access type: Read-only

Array that captures additional data, beyond DeviceID information, that could be used to identify a LogicalDevice. One example would be to hold the Operating System's user friendly name for the Device in this property. Maximum length is 256.

This property is inherited from CIM_LogicalDevice.

PNPDeviceID

Data type: string

Access type: Read-only

Qualifiers: Schema ("Win32")

Windows Plug and Play device identifier of the logical device.

Example: "*PNP030b"

This property is inherited from CIM_LogicalDevice.

PowerManagementCapabilities

Data type: uint16 array

Access type: Read-only

Indicates the specific power-related capabilities of the logical device. The array values, 0="Unknown", 1="Not Supported" and 2="Disabled" are self-explanatory. The value, 3="Enabled" indicates that the power management features are currently enabled but the exact feature set is unknown or the information is unavailable. "Power Saving Modes Entered Automatically" (4) describes that a device can change its power state based on usage or other criteria. "Power State Settable" (5) indicates that the SetPowerState method is supported. "Power Cycling Supported" (6) indicates that the SetPowerState method can be invoked with the PowerState input variable set to 5 ("Power Cycle"). "Timed Power On Supported" (7) indicates that the SetPowerState method can be invoked with the PowerState input variable set to 5 ("Power Cycle") and the Time parameter set to a specific date and time, or interval, for power-on.

This property is inherited from CIM_LogicalDevice.

Unknown (0)

Not Supported (1)

Disabled (2)

Enabled (3)

Power Saving Modes Entered Automatically (4)

Power State Settable (5)

Power Cycling Supported (6)

Timed Power On Supported (7)

PowerManagementSupported

Data type: boolean

Access type: Read-only

If True, the device can be power-managed (can be put into suspend mode, and so on). The property does not indicate that power management features are currently enabled, only that the logical device is capable of power management.

This property is inherited from CIM_LogicalDevice.

PowerOnHours

Data type: uint64

Access type: Read-only

The number of consecutive hours that this Device has been powered, since its last power cycle.

This property is inherited from CIM_LogicalDevice.

PrimaryPartition

Data type: boolean

Access type: Read-only

If True, this is the primary partition.

This property is inherited from CIM_DiskPartition.

Purpose

Data type: string

Access type: Read-only

Description of the media and its use.

This property is inherited from CIM_StorageExtent.

RewritePartition

Data type: boolean

Access type: Read-only

Qualifiers: MappingStrings ("Win32API|Device Input and Output Structures|PARTITION_INFORMATION|RewritePartition")

If True, the partition information has changed. When you change a partition (with IOCTL_DISK_SET_DRIVE_LAYOUT), the system uses this property to determine which partitions have changed and need their information rewritten. If TRUE, the partition must be rewritten.

Size

Data type: uint64

Access type: Read-only

Qualifiers: MappingStrings ("Win32API|File Functions|ReadFile"), units ("bytes")

Total size of the partition.

Example: 1059045376

For more information about using uint64 values in scripts, see Scripting in WMI.

StartingOffset

Data type: uint64

Access type: Read-only

Qualifiers: MappingStrings ("Win32API|File Functions|ReadFile"), units ("bytes")

Starting offset (in bytes) of the partition.

Example: 32256

For more information about using uint64 values in scripts, see Scripting in WMI.

Status

Data type: string

Access type: Read-only

Qualifiers: MaxLen (10), DisplayName ("Status")

Current status of the object. Various operational and nonoperational statuses can be defined. Operational statuses include: "OK", "Degraded", and "Pred Fail" (an element, such as a SMART-enabled hard disk drive, may be functioning properly but predicting a failure in the near future). Nonoperational statuses include: "Error", "Starting", "Stopping", and "Service". The latter, "Service", could apply during mirror-resilvering of a disk, reload of a user permissions list, or other administrative work. Not all such work is online, yet the managed element is neither "OK" nor in one of the other states.

This property is inherited from CIM_ManagedSystemElement.

The values are:

OK ("OK")

Error ("Error")

Degraded ("Degraded")

Unknown ("Unknown")

Pred Fail ("Pred Fail")

Starting ("Starting")

Stopping ("Stopping")

Service ("Service")

Stressed ("Stressed")

NonRecover ("NonRecover")

No Contact ("No Contact")

Lost Comm ("Lost Comm")

StatusInfo

Data type: uint16

Access type: Read-only

Qualifiers: MappingStrings ("MIF.DMTF|Operational State|003.3")

State of the logical device. If this property does not apply to the logical device, the value 5 ("Not Applicable") should be used.

This property is inherited from CIM_LogicalDevice.

Other (1)

Unknown (2)

Enabled (3)

Disabled (4)

Not Applicable (5)

SystemCreationClassName

Data type: string

Access type: Read-only

Qualifiers: Propagated ("CIM_System.CreationClassName"), CIM_Key

Creation class name of the scoping system.

This property is inherited from CIM_LogicalDevice.

SystemName

Data type: string

Access type: Read-only

Qualifiers: Propagated ("CIM_System.Name"), CIM_Key

Name of the scoping system.

This property is inherited from CIM_LogicalDevice.

TotalPowerOnHours

Data type: uint64

Access type: Read-only

The total number of hours that this device has been powered.

This property is inherited from CIM_LogicalDevice.

Type

Data type: string

Access type: Read-only

Qualifiers: MappingStrings ("Win32API|PartitionRecord|dwPartitionType")

Type of the partition.

The values are:

"Unused"
"12-bit FAT"
"Xenix Type 1"
"Xenix Type 2"
"16-bit FAT"
"Extended Partition"
"MS-DOS V4 Huge"
"Installable File System"
"PowerPC Reference Platform"
"UNIX"
"NTFS"
"Win95 w/Extended Int 13"
"Extended w/Extended Int 13"
"Logical Disk Manager"
"Unknown"

Unused ("Unused")

12-bit FAT ("12-bit FAT")

Xenix Type 1 ("Xenix Type 1")

Xenix Type 2 ("Xenix Type 2")

16-bit FAT ("16-bit FAT")

Extended Partition ("Extended Partition")

MS-DOS V4 Huge ("MS-DOS V4 Huge")

Installable File System ("Installable File System")

PowerPC Reference Platform ("PowerPC Reference Platform")

UNIX ("UNIX")

NTFS ("NTFS")

Win95 w/Extended Int 13 ("Win95 w/Extended Int 13")

Extended w/Extended Int 13 ("Extended w/Extended Int 13")

Logical Disk Manager ("Logical Disk Manager")

Unknown ("Unknown")

Remarks

The Win32_DiskPartition class is derived from CIM_DiskPartition.

A partition is a structural division of a physical disk drive. Although a drive can contain a single partition, larger volumes are often divided into multiple partitions. This is why you might have drives C, D, and E even though your computer has only a single physical hard disk.

Windows supports the following partition types:

  • Primary partition. This is the only type of partition that can have an operating system installed. Each drive can have as many as four primary partitions, each assigned a different drive letter.
  • Extended partition. An additional partition that can be subdivided into multiple logical drives, each assigned a unique drive letter. A drive can have only one extended partition; however, you can divide this partition into multiple logical drives. This enables a disk to have more than just the four allowed primary partitions.
  • System partition. Any primary partition containing an operating system.

Partitions can tell you how a physical disk drive is actually being used. By examining the physical partitions on a disk, you can determine the following types of things:

  • How the disk has been divided into logical drives.
  • If there is unpartitioned space available on the disk. This can be determined by subtracting the size of all the partitions on a disk from the size of the disk itself.
  • If you can boot the computer from that disk (that is, does the disk contain a boot partition).

All these questions can be resolved by using the Win32_DiskPartition class.

Examples

The following PowerShell code sample checks the alignment of disks on a computer: if the offset is fractional, the disk is not aligned correctly.

$wql = "SELECT DiskIndex,Index,StartingOffset FROM Win32_DiskPartition"
Get-WmiObject -Query $wql -ComputerName '.' | Select-Object DiskIndex,Index,@{Name='Offset (KB)';Expression={$_.StartingOffset / 1024}} | Format-Table -AutoSize

Requirements

Requirement Value
Minimum supported client
Windows Vista
Minimum supported server
Windows Server 2008
Namespace
Root\CIMV2
MOF
CIMWin32.mof
DLL
CIMWin32.dll

See also

CIM_DiskPartition

Operating System Classes

WMI Tasks: Disks and File Systems