Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to find the hardDisk size of my system & configuration?
Posted

Use WMI: Include the System.Management assembly:

C#
    {
    ManagementObjectSearcher mosDisks = new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive");
    foreach (ManagementObject moDisk in mosDisks.Get())
        {
        ShowWMIObject("Type: " , moDisk["MediaType"]);
        ShowWMIObject("Model: " , moDisk["Model"]);
        ShowWMIObject("Serial: " , moDisk["SerialNumber"]);
        ShowWMIObject("Interface: " , moDisk["InterfaceType"]);
        ShowWMIObject("Capacity: " , moDisk["Size"]);
        ShowWMIObject("Partitions: " , moDisk["Partitions"]);
        ShowWMIObject("Signature: " , moDisk["Signature"]);
        ShowWMIObject("Firmware: " , moDisk["FirmwareRevision"]);
        ShowWMIObject("Cylinders: " , moDisk["TotalCylinders"]);
        ShowWMIObject("Sectors: " , moDisk["TotalSectors"]);
        ShowWMIObject("Heads: " , moDisk["TotalHeads"]);
        ShowWMIObject("Tracks: " , moDisk["TotalTracks"]);
        ShowWMIObject("Bytes per Sector: " , moDisk["BytesPerSector"]);
        ShowWMIObject("Sectors per Track: " , moDisk["SectorsPerTrack"]);
        ShowWMIObject("Tracks per Cylinder: " , moDisk["TracksPerCylinder"]);
        }
    }

private void ShowWMIObject(string p, object o)
    {
    if (o != null)
        {
        Console.WriteLine("{0}{1}", p, o);
        }
    }
 
Share this answer
 
Based on your tag, it does not looks like a programming question.
Steps:
1. Right click your hard disk you want to see the size of
2. Select Properties
3. A dialog would open showing you Used space & Free space.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900