Get Unpartitioned Space of DiskDrive

  • Thread starter Thread starter Juri
  • Start date Start date
J

Juri

Hello,

i am trying to get all Physical Drives with their logical Drives. So far i
am succeeded by using WMI with SELECT * FROM WIN32_DISKDrives and so on.

But i also need to get the unpartitioned DiskSpace of an physical drive. How
can i achieve this?

Thank you in advance!
 
Hello,

i am trying to get all Physical Drives with their logical Drives. So far i
am succeeded by using WMI with SELECT * FROM WIN32_DISKDrives and so on.

But i also need to get the unpartitioned DiskSpace of an physical drive. How
can i achieve this?

Thank you in advance!

Hi,

try this:

// with .NET 2.0
List<System.IO.DriveInfo> logicalDrives = new List<DriveInfo>();
foreach(System.IO.DriveInfo driveInfo in System.IO.DriveInfo.GetDrives
())
{
if(driveInfo.DriveType == DriveType.Fixed)
{
logicalDrives.Add(driveInfo);
}
}

// with .NET 3.5
List<System.IO.DriveInfo> drives = System.IO.DriveInfo.GetDrives
().Where(d => d.DriveType == DriveType.Fixed).ToList();

André
 
Back
Top