Win32_DiskPartition

Win32 Disk Partition
root/cimv2dynamickey : DeviceID

Represents the capabilities and management capacity of a partitioned area of a physical disk on a computer system running Windows.

On this page

Main example

List instances

# All instances of Win32_DiskPartition, with the main properties
Get-CimInstance -ClassName Win32_DiskPartition |
    Select-Object -Property @(
        'DeviceID'
        'Description'
        'Status'
        @{ Name = 'SizeGB'; Expression = { [math]::Round($_.Size / 1GB, 2) } }
        'InstallDate'
    )

Examples

Filter with WQL

# WQL filter evaluated by the provider: Access = 1 (Readable)
Get-CimInstance -ClassName Win32_DiskPartition -Filter 'Access = 1' |
    Select-Object -Property @(
        'DeviceID'
        'Description'
        'Status'
        @{ Name = 'SizeGB'; Expression = { [math]::Round($_.Size / 1GB, 2) } }
        'InstallDate'
    )

The filter is evaluated by the WMI provider: less data is transferred than with Where-Object.

Decode numeric values

# Lookup table for Access (values documented by Microsoft)
$accessName = @{
    0 = 'Unknown'
    1 = 'Readable'
    2 = 'Writeable'
    3 = 'Read/Write Supported'
    4 = 'Write Once'
}
# Lookup table for Availability (values documented by Microsoft)
$availabilityName = @{
    1 = 'Other'
    2 = 'Unknown'
    3 = 'Running/Full Power'
    4 = 'Warning'
    5 = 'In Test'
    6 = 'Not Applicable'
    7 = 'Power Off'
    8 = 'Off Line'
    9 = 'Off Duty'
    10 = 'Degraded'
    11 = 'Not Installed'
    12 = 'Install Error'
    13 = 'Power Save - Unknown'
    14 = 'Power Save - Low Power Mode'
    15 = 'Power Save - Standby'
    16 = 'Power Cycle'
    17 = 'Power Save - Warning'
    18 = 'Paused'
    19 = 'Not Ready'
    20 = 'Not Configured'
    21 = 'Quiesced'
}

Get-CimInstance -ClassName Win32_DiskPartition |
    Select-Object -Property @(
        'DeviceID'
        'Description'
        'Status'
        @{ Name = 'SizeGB'; Expression = { [math]::Round($_.Size / 1GB, 2) } }
        'InstallDate'
        @{ Name = 'Access'; Expression = { $accessName[[int]$_.Access] } }
        @{ Name = 'Availability'; Expression = { $availabilityName[[int]$_.Availability] } }
    )

Query a remote computer (CIM session)

review before running
# Name of the remote computer
$computerName = 'SERVER01'
# The CIM session (WSMan by default) can be reused for several queries
$cimSession = New-CimSession -ComputerName $computerName
try {
    Get-CimInstance -CimSession $cimSession -ClassName Win32_DiskPartition |
        Select-Object -Property @(
            'DeviceID'
            'Description'
            'Status'
            @{ Name = 'SizeGB'; Expression = { [math]::Round($_.Size / 1GB, 2) } }
            'InstallDate'
        )
} finally {
    Remove-CimSession -CimSession $cimSession
}

WSMan (WinRM) is used by default. For a host without WinRM, create the session with -SessionOption (New-CimSessionOption -Protocol Dcom). Add -Credential to use another account.

Show the class structure

# Class structure: properties, types and flags (Key, ReadOnly…)
$cimClass = Get-CimClass -ClassName Win32_DiskPartition
$cimClass.CimClassProperties |
    Select-Object -Property Name, CimType, Flags

# Methods of the class
$cimClass.CimClassMethods |
    Select-Object -Property Name, ReturnType

Properties

40 of 40 properties
NameTypeAccessDescription
Accessuint16read

Media access available.

Values (5)
ValueLabelDescription
0Unknown
1Readable
2WriteableWritable
3Read/Write Supported
4Write Once
Code
# Value of Access for each instance
# Lookup table for Access (values documented by Microsoft)
$accessName = @{
    0 = 'Unknown'
    1 = 'Readable'
    2 = 'Writeable'
    3 = 'Read/Write Supported'
    4 = 'Write Once'
}
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, Access |
    Select-Object -Property @(
        'DeviceID'
        @{ Name = 'Access'; Expression = { $accessName[[int]$_.Access] } }
    )
AdditionalAvailabilityunit16read

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)."

Values (21)
ValueLabelDescription
1Other
2Unknown
3Running/Full Power
4Warning
5In Test
6Not Applicable
7Power Off
8Off Line
9Off Duty
10Degraded
11Not Installed
12Install Error
13Power Save - Unknown
14Power Save - Low Power Mode
15Power Save - Standby
16Power Cycle
17Power Save - Warning
18Paused
19Not Ready
20Not Configured
21Quiesce
Code
# Value of AdditionalAvailability for each instance
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, AdditionalAvailability |
    Select-Object -Property DeviceID, AdditionalAvailability
Availabilityuint16read

Availability and status of the device.

Values (21)
ValueLabelDescription
1Other
2Unknown
3Running/Full Power
4Warning
5In Test
6Not Applicable
7Power Off
8Off Line
9Off Duty
10Degraded
11Not Installed
12Install Error
13Power Save - UnknownThe device is known to be in a power save mode, but its exact status is unknown.
14Power Save - Low Power ModeThe device is in a power save state but still functioning, and may exhibit degraded performance.
15Power Save - StandbyThe device is not functioning but could be brought to full power quickly.
16Power Cycle
17Power Save - WarningThe device is in a warning state, though also in a power save mode.
18PausedThe device is paused.
19Not ReadyThe device is not ready.
20Not ConfiguredThe device is not configured.
21QuiescedThe device is quiet.
Code
# Value of Availability for each instance
# Lookup table for Availability (values documented by Microsoft)
$availabilityName = @{
    1 = 'Other'
    2 = 'Unknown'
    3 = 'Running/Full Power'
    4 = 'Warning'
    5 = 'In Test'
    6 = 'Not Applicable'
    7 = 'Power Off'
    8 = 'Off Line'
    9 = 'Off Duty'
    10 = 'Degraded'
    11 = 'Not Installed'
    12 = 'Install Error'
    13 = 'Power Save - Unknown'
    14 = 'Power Save - Low Power Mode'
    15 = 'Power Save - Standby'
    16 = 'Power Cycle'
    17 = 'Power Save - Warning'
    18 = 'Paused'
    19 = 'Not Ready'
    20 = 'Not Configured'
    21 = 'Quiesced'
}
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, Availability |
    Select-Object -Property @(
        'DeviceID'
        @{ Name = 'Availability'; Expression = { $availabilityName[[int]$_.Availability] } }
    )
BlockSizeuint64read

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.

Unit: bytes

Code
# Value of BlockSize for each instance
# BlockSize is expressed in bytes: converted to GB
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, BlockSize |
    Select-Object -Property @(
        'DeviceID'
        @{ Name = 'BlockSizeGB'; Expression = { [math]::Round($_.BlockSize / 1GB, 2) } }
    )
Bootablebooleanread

Indicates whether the computer can be booted from this partition.

Code
# Value of Bootable for each instance
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, Bootable |
    Select-Object -Property DeviceID, Bootable
BootPartitionbooleanread

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

Code
# Value of BootPartition for each instance
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, BootPartition |
    Select-Object -Property DeviceID, BootPartition
Captionstring.read

Short description of the object.

Code
# Value of Caption for each instance
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, Caption |
    Select-Object -Property DeviceID, Caption
ConfigManagerErrorCodeuint32read

Windows Configuration Manager error code.

Values (32)
ValueLabelDescription
0This device is working properly.Device is working properly.
1This device is not configured correctly.Device is not configured correctly.
2Windows cannot load the driver for this device.
3The driver for this device might be corrupted, or your system may be running low on memory or other resources.
4This device is not working properly. One of its drivers or your registry might be corrupted.
5The driver for this device needs a resource that Windows cannot manage.
6The boot configuration for this device conflicts with other devices.
7Cannot filter.
8The driver loader for the device is missing.
9This device is not working properly because the controlling firmware is reporting the resources for the device incorrectly.
10This device cannot start.
11This device failed.
12This device cannot find enough free resources that it can use.
13Windows cannot verify this device's resources.
14This device cannot work properly until you restart your computer.
15This device is not working properly because there is probably a re-enumeration problem.
16Windows cannot identify all the resources this device uses.
17This device is asking for an unknown resource type.
18Reinstall the drivers for this device.
19Failure using the VxD loader.
20Your registry might be corrupted.
21System failure: Try changing the driver for this device. If that does not work, see your hardware documentation. Windows is removing this device.
22This device is disabled.
23System failure: Try changing the driver for this device. If that doesn't work, see your hardware documentation.
24This device is not present, is not working properly, or does not have all its drivers installed.
25Windows is still setting up this device.
26Windows is still setting up this device.
27This device does not have valid log configuration.
28The drivers for this device are not installed.
29This device is disabled because the firmware of the device did not give it the required resources.
30This device is using an Interrupt Request (IRQ) resource that another device is using.
31This device is not working properly because Windows cannot load the drivers required for this device.
Code
# Value of ConfigManagerErrorCode for each instance
# Lookup table for ConfigManagerErrorCode (values documented by Microsoft)
$configManagerErrorCodeName = @{
    0 = 'This device is working properly'
    1 = 'This device is not configured correctly'
    2 = 'Windows cannot load the driver for this device'
    3 = 'The driver for this device might be corrupted, or your…'
    4 = 'This device is not working properly'
    5 = 'The driver for this device needs a resource that Windows…'
    6 = 'The boot configuration for this device conflicts with other…'
    7 = 'Cannot filter'
    8 = 'The driver loader for the device is missing'
    9 = 'This device is not working properly because the controlling…'
    10 = 'This device cannot start'
    11 = 'This device failed'
    12 = 'This device cannot find enough free resources that it can use'
    13 = 'Windows cannot verify this device''s resources'
    14 = 'This device cannot work properly until you restart your…'
    15 = 'This device is not working properly because there is…'
    16 = 'Windows cannot identify all the resources this device uses'
    17 = 'This device is asking for an unknown resource type'
    18 = 'Reinstall the drivers for this device'
    19 = 'Failure using the VxD loader'
    20 = 'Your registry might be corrupted'
    21 = 'System failure: Try changing the driver for this device'
    22 = 'This device is disabled'
    23 = 'System failure: Try changing the driver for this device'
    24 = 'This device is not present, is not working properly, or does…'
    25 = 'Windows is still setting up this device'
    26 = 'Windows is still setting up this device'
    27 = 'This device does not have valid log configuration'
    28 = 'The drivers for this device are not installed'
    29 = 'This device is disabled because the firmware of the device…'
    30 = 'This device is using an Interrupt Request (IRQ) resource…'
    31 = 'This device is not working properly because Windows cannot…'
}
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, ConfigManagerErrorCode |
    Select-Object -Property @(
        'DeviceID'
        @{ Name = 'ConfigManagerErrorCode'; Expression = { $configManagerErrorCodeName[[int]$_.ConfigManagerErrorCode] } }
    )
ConfigManagerUserConfigbooleanread

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

Code
# Value of ConfigManagerUserConfig for each instance
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, ConfigManagerUserConfig |
    Select-Object -Property DeviceID, ConfigManagerUserConfig
CreationClassName keystring.read

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.

Code
# Value of CreationClassName for each instance
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, CreationClassName |
    Select-Object -Property DeviceID, CreationClassName
Descriptionstringread

Description of the object.

Code
# Value of Description for each instance
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, Description |
    Select-Object -Property DeviceID, Description
DeviceID keystringread

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

Code
# Value of DeviceID for each instance
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID |
    Select-Object -Property DeviceID
DiskIndexuint32read

Index number of the disk containing this partition.

Example: 0

Code
# Value of DiskIndex for each instance
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, DiskIndex |
    Select-Object -Property DeviceID, DiskIndex
ErrorClearedbooleanread

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

Code
# Value of ErrorCleared for each instance
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, ErrorCleared |
    Select-Object -Property DeviceID, ErrorCleared
ErrorDescriptionstringread

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

Code
# Value of ErrorDescription for each instance
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, ErrorDescription |
    Select-Object -Property DeviceID, ErrorDescription
ErrorMethodologystringread

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

Code
# Value of ErrorMethodology for each instance
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, ErrorMethodology |
    Select-Object -Property DeviceID, ErrorMethodology
HiddenSectorsuint32read

Number of hidden sectors in the partition.

Example: 63

Code
# Value of HiddenSectors for each instance
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, HiddenSectors |
    Select-Object -Property DeviceID, HiddenSectors
IdentifyingDescriptionsstring[]read

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.

Code
# Value of IdentifyingDescriptions for each instance
# IdentifyingDescriptions is an array: -ExpandProperty returns its items one by one
Get-CimInstance -ClassName Win32_DiskPartition -Property IdentifyingDescriptions |
    Select-Object -ExpandProperty IdentifyingDescriptions
Indexuint32read

Index number of the partition.

Example: 1

Code
# Value of Index for each instance
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, Index |
    Select-Object -Property DeviceID, Index
InstallDatedatetimeread

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

Code
# Value of InstallDate for each instance
# CIM cmdlets already return a DateTime object: no conversion is needed
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, InstallDate |
    Select-Object -Property DeviceID, InstallDate
LastErrorCodeuint32read

Last error code reported by the logical device.

Code
# Value of LastErrorCode for each instance
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, LastErrorCode |
    Select-Object -Property DeviceID, LastErrorCode
MaxQuiesceTimeuint64read

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

Code
# Value of MaxQuiesceTime for each instance
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, MaxQuiesceTime |
    Select-Object -Property DeviceID, MaxQuiesceTime
Namestringread

Label by which the object is known. When subclassed, the property can be overridden to be a key property.

Code
# Value of Name for each instance
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, Name |
    Select-Object -Property DeviceID, Name
NumberOfBlocksuint64read

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.

Code
# Value of NumberOfBlocks for each instance
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, NumberOfBlocks |
    Select-Object -Property DeviceID, NumberOfBlocks
OtherIdentifyingInfouint64read

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.

Code
# Value of OtherIdentifyingInfo for each instance
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, OtherIdentifyingInfo |
    Select-Object -Property DeviceID, OtherIdentifyingInfo
PNPDeviceIDstringread

Windows Plug and Play device identifier of the logical device.

Example: "*PNP030b"

Code
# Value of PNPDeviceID for each instance
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, PNPDeviceID |
    Select-Object -Property DeviceID, PNPDeviceID
PowerManagementCapabilitiesuint16[]read

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.

Values (8)
ValueLabelDescription
0Unknown
1Not Supported
2Disabled
3Enabled
4Power Saving Modes Entered Automatically
5Power State Settable
6Power Cycling Supported
7Timed Power On Supported
Code
# Value of PowerManagementCapabilities for each instance
# Lookup table for PowerManagementCapabilities (values documented by Microsoft)
$powerManagementCapabilitiesName = @{
    0 = 'Unknown'
    1 = 'Not Supported'
    2 = 'Disabled'
    3 = 'Enabled'
    4 = 'Power Saving Modes Entered Automatically'
    5 = 'Power State Settable'
    6 = 'Power Cycling Supported'
    7 = 'Timed Power On Supported'
}
# PowerManagementCapabilities is an array: -ExpandProperty returns its items one by one
Get-CimInstance -ClassName Win32_DiskPartition -Property PowerManagementCapabilities |
    Select-Object -ExpandProperty PowerManagementCapabilities |
    ForEach-Object -Process { $powerManagementCapabilitiesName[[int]$_] }
PowerManagementSupportedbooleanread

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.

Code
# Value of PowerManagementSupported for each instance
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, PowerManagementSupported |
    Select-Object -Property DeviceID, PowerManagementSupported
PowerOnHoursuint64read

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

Code
# Value of PowerOnHours for each instance
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, PowerOnHours |
    Select-Object -Property DeviceID, PowerOnHours
PrimaryPartitionbooleanread

If True, this is the primary partition.

Code
# Value of PrimaryPartition for each instance
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, PrimaryPartition |
    Select-Object -Property DeviceID, PrimaryPartition
Purposestringread

Description of the media and its use.

Code
# Value of Purpose for each instance
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, Purpose |
    Select-Object -Property DeviceID, Purpose
RewritePartitionbooleanread

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.

Code
# Value of RewritePartition for each instance
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, RewritePartition |
    Select-Object -Property DeviceID, RewritePartition
Sizeuint64read

Total size of the partition.

Example: 1059045376

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

Unit: bytes

Code
# Value of Size for each instance
# Size is expressed in bytes: converted to GB
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, Size |
    Select-Object -Property @(
        'DeviceID'
        @{ Name = 'SizeGB'; Expression = { [math]::Round($_.Size / 1GB, 2) } }
    )
StartingOffsetuint64read

Starting offset (in bytes) of the partition.

Example: 32256

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

Unit: bytes

Code
# Value of StartingOffset for each instance
# StartingOffset is expressed in bytes: converted to GB
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, StartingOffset |
    Select-Object -Property @(
        'DeviceID'
        @{ Name = 'StartingOffsetGB'; Expression = { [math]::Round($_.StartingOffset / 1GB, 2) } }
    )
Statusstringread

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.

The values are:

Values (12)
ValueLabelDescription
OKOK
ErrorError
DegradedDegraded
UnknownUnknown
Pred FailPred Fail
StartingStarting
StoppingStopping
ServiceService
StressedStressed
NonRecoverNonRecover
No ContactNo Contact
Lost CommLost Comm
Code
# Value of Status for each instance
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, Status |
    Select-Object -Property DeviceID, Status
StatusInfouint16read

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

Values (5)
ValueLabelDescription
1Other
2Unknown
3Enabled
4Disabled
5Not Applicable
Code
# Value of StatusInfo for each instance
# Lookup table for StatusInfo (values documented by Microsoft)
$statusInfoName = @{
    1 = 'Other'
    2 = 'Unknown'
    3 = 'Enabled'
    4 = 'Disabled'
    5 = 'Not Applicable'
}
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, StatusInfo |
    Select-Object -Property @(
        'DeviceID'
        @{ Name = 'StatusInfo'; Expression = { $statusInfoName[[int]$_.StatusInfo] } }
    )
SystemCreationClassName keystringread

Creation class name of the scoping system.

Code
# Value of SystemCreationClassName for each instance
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, SystemCreationClassName |
    Select-Object -Property DeviceID, SystemCreationClassName
SystemName keystringread

Name of the scoping system.

Code
# Value of SystemName for each instance
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, SystemName |
    Select-Object -Property DeviceID, SystemName
TotalPowerOnHoursuint64read

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

Code
# Value of TotalPowerOnHours for each instance
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, TotalPowerOnHours |
    Select-Object -Property DeviceID, TotalPowerOnHours
Typestringread

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"

Values (15)
ValueLabelDescription
UnusedUnused
12-bit FAT12-bit FAT
Xenix Type 1Xenix Type 1
Xenix Type 2Xenix Type 2
16-bit FAT16-bit FAT
Extended PartitionExtended Partition
MS-DOS V4 HugeMS-DOS V4 Huge
Installable File SystemInstallable File System
PowerPC Reference PlatformPowerPC Reference Platform
UNIXUNIX
NTFSNTFS
Win95 w/Extended Int 13Win95 w/Extended Int 13
Extended w/Extended Int 13Extended w/Extended Int 13
Logical Disk ManagerLogical Disk Manager
UnknownUnknown
Code
# Value of Type for each instance
Get-CimInstance -ClassName Win32_DiskPartition -Property DeviceID, Type |
    Select-Object -Property DeviceID, Type

Methods

Reset #

Requests a reset of the logical device.

uint32 Reset();

Call the Reset method

review before running
# Warning: this method can change the system. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_DiskPartition -Filter "DeviceID = 'Example'"
$methodParameters = @{
    InputObject = $instance
    MethodName  = 'Reset'
    WhatIf      = $true  # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters

# With -WhatIf nothing runs and no result is returned
if ($result) {
    $result.ReturnValue
}

This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.

SetPowerState #

Sets the desired power state for a logical device and when a device should be put into that state.

uint32 SetPowerState([in] uint16 PowerState, [in] datetime Time);

Parameters

ParameterTypeDirectionDescription
PowerStateuint16in

A ValueMap value that specifies the desired power state for this logical device.

1

Full power.

2

Power save low-power mode.

3

Power save standby.

4

Power save other.

5

Power cycle.

6

Power off.

Timedatetimein

Specifies when the power state should be set, either as a regular date-time value or as an interval value (where the interval begins when the method invocation is received). When the *PowerState* parameter is equal to 5 ("Power Cycle"), the *Time* parameter indicates when the device should power on again. Power-off is immediate.

Call the SetPowerState method

review before running
# Warning: this method can change the system. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_DiskPartition -Filter "DeviceID = 'Example'"
$methodParameters = @{
    InputObject = $instance
    MethodName  = 'SetPowerState'
    Arguments   = @{
        PowerState = 0
        Time       = (Get-Date)
    }
    WhatIf      = $true  # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters

# With -WhatIf nothing runs and no result is returned
if ($result) {
    $result.ReturnValue
}

This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.

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.

Inheritance

Superclass chain

  1. CIM_ManagedSystemElement
  2. CIM_LogicalElement
  3. CIM_LogicalDevice
  4. CIM_StorageExtent
  5. CIM_DiskPartition
  6. Win32_DiskPartition

Known subclasses

No known subclass.

Requirements

Namespace
root/cimv2
Minimum client
Windows Vista
Minimum server
Windows Server 2008
Provider
CIMWin32
MOF file
CIMWin32.mof
DLL
CIMWin32.dll
Class qualifiers

Dynamic Provider("CIMWin32") UUID("{8502C4B8-5FBB-11D2-AAC1-006008C78BC7}") AMENDMENT

Microsoft source

Source: Microsoft Learn

Descriptions, properties and methods come from the Microsoft documentation (MicrosoftDocs/win32 repository), published under the CC BY 4.0 licence. Formatting and translations are specific to this site; the PowerShell examples are written for it.