Hello I'm using Win32\_DiskDrive to get all physical disk and then using Win32\_DiskPartition to get physical disk partitions,

But I'm stuck with how to do I get free space of each partition and how do I get each partition Letter, 

tried to use Win32\_LogicalDisk, it retrieves partition letter and free space, 

but there is nothing where I could indentify which partition letter and size belongs to physical drive.

```
ManagementObjectSearcher wmiService = new ManagementObjectSearcher("select Index,MediaType,Model,Partitions,Size,Status,SerialNumber from Win32_DiskDrive where MediaType = 'Removable media' or MediaType = 'External hard disk media' or MediaType = 'Fixed hard disk media'");
foreach (ManagementObject obj in wmiService.Get())
{
    string id = obj["Index"].ToString();
    Console.WriteLine("Index: " + id);
    Console.WriteLine("MediaType: " + obj["MediaType"]);
    Console.WriteLine("Model: " + obj["Model"]);
    Console.WriteLine("Partitions: " + obj["Partitions"]);
    double size = ((Convert.ToDouble(obj["Size"]) / 1024) / 1024) / 1024;//GB
    Console.WriteLine("Size: " + Math.Round(size,1));
    Console.WriteLine("Status: " + obj["Status"]);
    Console.WriteLine("SerialNumber: " + obj["SerialNumber"]);
    Console.WriteLine();

    ManagementObjectSearcher wmiService2 = new ManagementObjectSearcher("select Bootable,BootPartition,DiskIndex,Index,PrimaryPartition,Size from Win32_DiskPartition where DiskIndex = '"+id+"'");
    foreach (ManagementObject obj2 in wmiService2.Get())
    {
        Console.WriteLine("Bootable: " + obj2["Bootable"]);
        Console.WriteLine("BootPartition: " + obj2["BootPartition"]);
        Console.WriteLine("DiskIndex: " + obj2["DiskIndex"]);
        Console.WriteLine("Index: " + obj2["Index"]);
        Console.WriteLine("PrimaryPartition: " + obj2["PrimaryPartition"]);
        double size2 = ((Convert.ToDouble(obj2["Size"]) / 1024) / 1024) / 1024;//GB
        Console.WriteLine("Size: " + Math.Round(size, 1));
        Console.WriteLine();
    }
}

```

Here I retrieve each disk partition list.

```
ManagementObjectSearcher wmiService3 = new ManagementObjectSearcher("select * from Win32_LogicalDisk");
        foreach (ManagementObject obj in wmiService3.Get())
        {
            Console.WriteLine("Access: " + obj["Access"]);
            Console.WriteLine("Availability: " + obj["Availability"]);
            Console.WriteLine("BlockSize: " + obj["BlockSize"]);
            Console.WriteLine("Caption: " + obj["Caption"]);
            Console.WriteLine("Compressed: " + obj["Compressed"]);
            Console.WriteLine("ConfigManagerErrorCode: " + obj["ConfigManagerErrorCode"]);
            Console.WriteLine("ConfigManagerUserConfig: " + obj["ConfigManagerUserConfig"]);
            Console.WriteLine("CreationClassName: " + obj["CreationClassName"]);
            Console.WriteLine("Description: " + obj["Description"]);
            Console.WriteLine("DriveType: " + obj["DriveType"]);
            Console.WriteLine("ErrorCleared: " + obj["ErrorCleared"]);
            Console.WriteLine("ErrorDescription: " + obj["ErrorDescription"]);
            Console.WriteLine("ErrorMethodology: " + obj["ErrorMethodology"]);
            Console.WriteLine("FileSystem: " + obj["FileSystem"]);
            Console.WriteLine("FreeSpace: " + obj["FreeSpace"]);
            Console.WriteLine("DeviceID: " + obj["DeviceID"]);
            Console.WriteLine("InstallDate: " + obj["InstallDate"]);
            Console.WriteLine("LastErrorCode: " + obj["LastErrorCode"]);
            Console.WriteLine("MaximumComponentLength: " + obj["MaximumComponentLength"]);
            Console.WriteLine("MediaType: " + obj["MediaType"]);
            Console.WriteLine("Name: " + obj["Name"]);
            Console.WriteLine("NumberOfBlocks: " + obj["NumberOfBlocks"]);
            Console.WriteLine("PNPDeviceID: " + obj["PNPDeviceID"]);
            Console.WriteLine("PowerManagementCapabilities: " + obj["PowerManagementCapabilities"]);
            Console.WriteLine("PowerManagementSupported: " + obj["PowerManagementSupported"]);
            Console.WriteLine("ProviderName: " + obj["ProviderName"]);
            Console.WriteLine("Purpose: " + obj["Purpose"]);
            Console.WriteLine("QuotasDisabled: " + obj["QuotasDisabled"]);
            Console.WriteLine("QuotasIncomplete: " + obj["QuotasIncomplete"]);
            Console.WriteLine("QuotasRebuilding: " + obj["QuotasRebuilding"]);
            Console.WriteLine("Size: " + obj["Size"]);
            Console.WriteLine("Status: " + obj["Status"]);
            Console.WriteLine("StatusInfo: " + obj["StatusInfo"]);
            Console.WriteLine("SupportsDiskQuotas: " + obj["SupportsDiskQuotas"]);
            Console.WriteLine("SupportsFileBasedCompression: " + obj["SupportsFileBasedCompression"]);
            Console.WriteLine("SystemCreationClassName: " + obj["SystemCreationClassName"]);
            Console.WriteLine("SystemName: " + obj["SystemName"]);
            Console.WriteLine("VolumeDirty: " + obj["VolumeDirty"]);
            Console.WriteLine("VolumeName: " + obj["VolumeName"]);
            Console.WriteLine("VolumeSerialNumber: " + obj["VolumeSerialNumber"]);
            Console.WriteLine();
        }

```

Here is what Win32\_LogicalDisk outputs.