Win32_Volume class
The Win32_Volume class represents an area of storage on a hard disk. The class returns local volumes that are formatted, unformatted, mounted, or offline. A volume is formatted by using a file system, such as FAT or NTFS, and might have a drive letter assigned to it. One hard disk can have multiple volumes, and volumes can span multiple physical disks. The Win32_Volume class does not support disk drive management.
Windows XP and earlier: This class is not available.
The following syntax is simplified from Managed Object Format (MOF) code and includes all of the inherited properties. Properties and methods are in alphabetic order, not MOF order.
Syntax
class Win32_Volume : CIM_StorageVolume
{
uint16 Access;
boolean Automount;
uint16 Availability;
uint64 BlockSize;
uint64 Capacity;
string Caption;
boolean Compressed;
uint32 ConfigManagerErrorCode;
boolean ConfigManagerUserConfig;
string CreationClassName;
string Description;
string DeviceID;
boolean DirtyBitSet;
string DriveLetter;
uint32 DriveType;
boolean ErrorCleared;
string ErrorDescription;
string ErrorMethodology;
string FileSystem;
uint64 FreeSpace;
boolean IndexingEnabled;
datetime InstallDate;
string Label;
uint32 LastErrorCode;
uint32 MaximumFileNameLength;
string Name;
uint64 NumberOfBlocks;
string PNPDeviceID;
uint16[] PowerManagementCapabilities;
boolean PowerManagementSupported;
string Purpose;
boolean QuotasEnabled;
boolean QuotasIncomplete;
boolean QuotasRebuilding;
string Status;
uint16 StatusInfo;
string SystemCreationClassName;
string SystemName;
uint32 SerialNumber;
boolean SupportsDiskQuotas;
boolean SupportsFileBasedCompression;
};
Members
The Win32_Volume class has these types of members:
Methods
The Win32_Volume class has these methods.
| Method | Description |
|---|---|
| AddMountPoint |
Adds a mount point directory for the volume. |
| Chkdsk |
Invokes the Chkdsk operation on the volume. |
| Defrag |
Defragments the volume. |
| DefragAnalysis |
Generates a fragmentation analysis for the volume. |
| Dismount |
Dismounts a volume from the file system. |
| ExcludeFromAutoChk |
Excludes volumes from the Chkdsk operation to be run at the next reboot. |
| Format |
Formats the volume. |
| Mount |
Mounts a volume to the file system. |
| ScheduleAutoChk |
Schedules Chkdsk to be run at the next reboot if the dirty bit of the volume is set. |
Properties
The Win32_Volume class has these properties.
- Access
-
- Data type: uint16
- Access type: Read-only
Describes whether the media is readable. This can be one of the following values.
Value Meaning - 0 (0x0)
Unknown media.
- 1 (0x1)
The media is readable.
- 2 (0x2)
The media is writable.
- 3 (0x3)
The media is readable and writable.
- 4 (0x4)
"Write once" media.
- Automount
-
- Data type: boolean
- Access type: Read-only
If true, the volume is mounted to the file system automatically when the first I/O is issued. If false, the volume is not mounted until explicitly mounted by using the Mount method, or by adding a drive letter or mount point.
- Availability
-
- Data type: uint16
- Access type: Read-only
Describes the availability and status of the device. This can be one of the following values.
Value Meaning - 1 (0x1)
Other
- 2 (0x2)
Unknown
- 3 (0x3)
Running or Full Power
- 4 (0x4)
Warning
- 5 (0x5)
In Test
- 6 (0x6)
Not Applicable
- 7 (0x7)
Power Off
- 8 (0x8)
Offline
- 9 (0x9)
Off Duty
- 10 (0xA)
Degraded
- 11 (0xB)
Not Installed
- 12 (0xC)
Install Error
- 13 (0xD)
Power Save - Unknown
- 14 (0xE)
Power Save - Low Power Mode
- 15 (0xF)
Power Save - Standby
- 16 (0x10)
Power Cycle
- 17 (0x11)
Power Save - Warning
- 18 (0x12)
Paused
- 19 (0x13)
Not Ready
- 20 (0x14)
Not Configured
- 21 (0x15)
Quiesced
- BlockSize
-
- Data type: uint64
- Access type: Read-only
Size in bytes of the blocks in this storage extent. If there is a variable block size, then the maximum block size in bytes is specified. If the block size is unknown or if a block concept is not valid (for example, for Aggregate Extents, Memory, or LogicalDisks), the value is 1 (one).
- Capacity
-
- Data type: uint64
- Access type: Read-only
Size of the volume in bytes.
For more information about using uint64 values in scripts, see Scripting in WMI.
- Caption
-
- Data type: string
- Access type: Read-only
A short description of the area of storage.
- Compressed
-
- Data type: boolean
- Access type: Read-only
If true, the volume exists as one compressed entity, such as a DoubleSpace volume. If file-based compression is supported, such as the NTFS file system, this property is false.
- ConfigManagerErrorCode
-
- Data type: uint32
- Access type: Read-only
Indicates the Win32 Configuration Manager error code. This can be one of the following values.
Value Meaning - 0 (0x0)
This device is working properly.
- 1 (0x1)
This device is not configured correctly.
- 2 (0x2)
Windows cannot load the driver for this device.
- 3 (0x3)
The driver for this device might be corrupted, or your system may be running low on memory or other resources.
- 4 (0x4)
This device is not working properly. One of its drivers or your registry might be corrupted.
- 5 (0x5)
The driver for this device needs a resource that Windows cannot manage.
- 6 (0x6)
The boot configuration for this device conflicts with other devices.
- 7 (0x7)
Cannot filter.
- 8 (0x8)
The driver loader for the device is missing.
- 9 (0x9)
This device is not working properly because the controlling firmware is reporting the resources for the device incorrectly.
- 10 (0xA)
This device cannot start.
- 11 (0xB)
This device failed.
- 12 (0xC)
This device cannot find enough free resources that it can use.
- 13 (0xD)
Windows cannot verify this device's resources.
- 14 (0xE)
This device cannot work properly until you restart your computer.
- 15 (0xF)
This device is not working properly because there is probably a re-enumeration problem.
- 16 (0x10)
Windows cannot identify all the resources this device uses.
- 17 (0x11)
This device is asking for an unknown resource type.
- 18 (0x12)
Reinstall the drivers for this device.
- 19 (0x13)
Failure using the VxD loader.
- 20 (0x14)
Your registry might be corrupted.
- 21 (0x15)
System failure. Try changing the driver for this device. If that does not work, see your hardware documentation. Windows is removing this device.
- 22 (0x16)
This device is disabled.
- 23 (0x17)
System failure. Try changing the driver for this device. If that does not work, see your hardware documentation.
- 24 (0x18)
This device is not present, is not working properly, or does not have all of its drivers installed.
- 25 (0x19)
Windows is still setting up this device.
- 26 (0x1A)
Windows is still setting up this device.
- 27 (0x1B)
This device does not have a valid log configuration.
- 28 (0x1C)
The drivers for this device are not installed.
- 29 (0x1D)
This device is disabled because the firmware of the device did not give it the required resources.
- 30 (0x1E)
This device is using an Interrupt Request resource that another device is using.
- 31 (0x1F)
This device is not working properly because Windows cannot load the drivers required for this device.
- ConfigManagerUserConfig
-
- Data type: boolean
- Access type: Read-only
True, if the device is using a user-defined configuration, otherwise False.
- CreationClassName
-
- Data type: string
- Access type: Read-only
Indicates the name of the class or the subclass used in the creation of an instance of this class. When used with the other key properties of this class, this property allows all instances of this class and its subclasses to be uniquely identified.
- Description
-
- Data type: string
- Access type: Read-only
A description of the object.
- DeviceID
-
- Data type: string
- Access type: Read-only
Unique identifier for the volume on this system.
- DirtyBitSet
-
- Data type: boolean
- Access type: Read-only
If true, the Chkdsk method is automatically run by the system at the next restart.
- DriveLetter
-
- Data type: string
- Access type: Read/write
Drive letter assigned to a volume. This property is NULL for volumes without drive letters.
- DriveType
-
- Data type: uint32
- Access type: Read-only
Numeric value that corresponds to the type of disk drive that this logical disk represents.
The values are:
Value Meaning - 0 (0x0)
Unknown
- 1 (0x1)
No Root Directory
- 2 (0x2)
Removable Disk
- 3 (0x3)
Local Disk
- 4 (0x4)
Network Drive
- 5 (0x5)
Compact Disk
- 6 (0x6)
RAM Disk
- ErrorCleared
-
- Data type: boolean
- Access type: Read-only
True, if the error reported in the LastErrorCode property is cleared, otherwise False.
- ErrorDescription
-
- Data type: string
- Access type: Read-only
Supplies more information about the error recorded in the LastErrorCode property and information on any corrective actions that may be taken.
- ErrorMethodology
-
- Data type: string
- Access type: Read-only
Describes the type of error detection and correction supported by this storage extent.
- FileSystem
-
- Data type: string
- Access type: Read-only
File system on the logical disk.
Example: NTFS
- FreeSpace
-
- Data type: uint64
- Access type: Read-only
Number of bytes of available space on the volume.
For more information about using uint64 values in scripts, see Scripting in WMI.
- IndexingEnabled
-
- Data type: boolean
- Access type: Read/write
If true, context indexing is enabled.
- InstallDate
-
- Data type: datetime
- Access type: Read-only
Indicates when the object was installed. A lack of a value does not indicate that the object is not installed.
- Label
-
- Data type: string
- Access type: Read/write
Volume name of the logical disk. This property is null for volumes without a label. For FAT and FAT32 systems, the maximum length is 11 characters. For NTFS file systems, the maximum length is 32 characters.
- LastErrorCode
-
- Data type: uint32
- Access type: Read-only
Captures the last error code reported by the logical device.
- MaximumFileNameLength
-
- Data type: uint32
- Access type: Read-only
Maximum length, in characters, of a filename component supported by a Windows drive. A filename component is the portion of a filename between backslashes. This value can be used to indicate that long names are supported by the file system. For example, for a FAT file system that supports long names, the property stores the value 255—not the previous 8.3 indicator. Long names can be supported on systems that use the NTFS file system.
Example: 255
- Name
-
- Data type: string
- Access type: Read-only
Defines the label by which the object is known. When subclassed, the Name property can be overridden to be a Key property.
- NumberOfBlocks
-
- Data type: uint64
- Access type: Read-only
Total number of consecutive blocks (each block is the size of the value contained in the BlockSize property) that form this storage extent. The 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.
- PNPDeviceID
-
- Data type: string
- Access type: Read-only
Indicates the Win32 Plug and Play device ID of the logical device. Example: *PNP030b.
- PowerManagementCapabilities
-
- Data type: uint16[]
- Access type: Read-only
Indicates the specific power-related capabilities of the logical device. This can be one of the following values.
Value Meaning - 0 (0x0)
Unknown
- 1 (0x1)
Not Supported
- 2 (0x2)
Disabled
- 3 (0x3)
Enabled
- 4 (0x4)
Power Saving Modes Entered Automatically
- 5 (0x5)
Power State Settable
- 6 (0x6)
Power Cycling Supported
- 7 (0x7)
Timed Power-On Supported
- PowerManagementSupported
-
- Data type: boolean
- Access type: Read-only
True, if the device can be power managed (put into a power save state), otherwise False. This boolean does not indicate that power management features are currently enabled, or if enabled, what features are supported. Refer to the PowerManagementCapabilities array for this information. If this boolean is false, the integer value 1, for the string, "Not Supported", should be the only entry in the PowerManagementCapabilities array.
- Purpose
-
- Data type: string
- Access type: Read-only
Describes the media and its use.
- QuotasEnabled
-
- Data type: boolean
- Access type: Read-only
If true, quota management is enabled for this volume.
- QuotasIncomplete
-
- Data type: boolean
- Access type: Read-only
If true, quota management was used but is disabled. Incomplete refers to the information left in the file system after quota management is disabled.
- QuotasRebuilding
-
- Data type: boolean
- Access type: Read-only
If true, the file system is in the process of compiling information and setting the disk up for quota management.
- SerialNumber
-
- Data type: uint32
- Access type: Read-only
Serial number of the volume.
Example: A8C3D032
- Status
-
- Data type: string
- Access type: Read-only
Indicates the current status of the object. Various operational and nonoperational statuses are defined. Operational statuses are "OK", "Degraded" and "Pred Fail". "Pred Fail" indicates that an element may be functioning properly but predicting a failure in the near future. Nonoperational statuses can also be specified. These are "Error", "Starting", "Stopping", and "Service".
- StatusInfo
-
- Data type: uint16
- Access type: Read-only
Indicates the state of the logical device. This can be one of the following values.
Value Meaning - 1 (0x1)
Other
- 2 (0x2)
Unknown
- 3 (0x3)
Enabled
- 4 (0x4)
Disabled
- 5 (0x5)
Not Applicable
- SupportsDiskQuotas
-
- Data type: boolean
- Access type: Read-only
If true, the volume supports disk quotas.
- SupportsFileBasedCompression
-
- Data type: boolean
- Access type: Read-only
If true, the volume supports file-based compression—like the NTFS file system.
- SystemCreationClassName
-
- Data type: string
- Access type: Read-only
Indicates the system's creation class name.
- SystemName
-
- Data type: string
- Access type: Read-only
Indicates the system's name.
Examples
For script code examples, see WMI Tasks for Scripts and Applications and the TechNet ScriptCenter Script Repository.
For C++ code examples, see WMI C++ Application Examples.
Requirements
|
Minimum supported client | None supported [desktop apps only] |
|---|---|
|
Minimum supported server | Windows Server 2003 [desktop apps only] |
|
Namespace |
\root\CIMV2 |
|
MOF |
|
|
DLL |
|
See also
- Storage Volume Provider
- Win32_VolumeQuota
- Win32_VolumeUserQuota
- Win32_DefragAnalysis
- Win32_MountPoint
Send comments about this topic to Microsoft
Build date: 11/19/2012