Jitesh Byahut 2/16/2014 2236

Win32_DiskPartition in WMI C# Asp.Net

Here we are retrieving disk partition details of Computer.

Use namespace System.Management

ManagementObjectSearcher objpartition = new ManagementObjectSearcher("select * from Win32_DiskPartition");

        foreach (ManagementObject obj in objpartition.Get())

        {

            Response.Write("Name     -   " + obj["Name"] + "</br>");

            Response.Write("Size - " + obj["Size"] + "</br>");

            Response.Write("BlockSize   -  " + obj["BlockSize"] + "</br>");

            Response.Write("NumberOfBlocks  -    " + obj["NumberOfBlocks"] + "</br>");

            Response.Write("Type - " + obj["Type"] + "</br></br>");

        }

Demo

View output :

demoimage


Please give your feedback for improving this page