What is the difference between properties `Name`, `Caption` and `DeviceID` (when executing `wmic LogicalDisk`)?
Emily Wong
When executing the command line wmic LogicalDisk, several properties of all logical disks of the computer system are returned. Three of them are Name, Caption and DeviceID, having the same value per drive, namely the drive letter C:, D:, etc.
What is the difference between these properties? Which one always returns the drive letter that I can access the respective drive with in the console cmd?
1 Answer
==> wmic logicaldisk get Caption, DeviceID, Name
Caption DeviceID Name
C: C: C:
D: D: D:
E: E: E:
==>Pay your attention to each property Qualifiers in Win32_LogicalDisk class documentation:
Caption
- Data type: string
- Access type: Read-only
- Qualifiers: MaxLen (64), DisplayName ("Caption")
- Short description of the object—a one-line string. 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 logical disk from other devices on the system. 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, this property can be overridden to be a key property. This property is inherited from CIM_ManagedSystemElement.
Key Qualifier is fundamental:
The
Keyqualifier indicates whether the property is part of the namespace handle.
Moreover, there is next important note inside the former link:
2The Get Disk info using wmi/cim... do it the right way PowerShell code example on the TechNet Gallery uses
Win32_LogicalDiskto retrieveDeviceID,VolumeName, andSizefrom a target device. In particular, this sample includes rigorous exception handling, and returns a single object per computer, rather than per disk.