please arrange this sample code for getting hard disk spce using win32_logicaldisk.
hi all
i am using this code to get free space of hard disk drives. i want to get the logical drives ie.(C: 10GB, D: 5.8GB, E: 6.2GB) with free space on individual logical drives, inside a "label.text" or some other suitable container.
please somebody re-arrange this code.
Code:
page load()
{
ManagementClass partionsClass = new ManagementClass("Win32_LogicalDisk");
ManagementObjectCollection partions = partionsClass.GetInstances();
string hdd = string.Empty;
foreach (ManagementObject partion in partions)
{
hdd = Convert.ToString(partion["freespace"]);
}
}
Re: please arrange this sample code for getting hard disk spce using win32_logicaldisk.
What does that code do currently?
What is it not doing that you want it to do?