Jitesh Byahut 2/16/2014 2343

Win32_LogicalDisk in WMI C# Asp.Net

Here we are retreiving Logical Disks details of Computer.

Use namespace System.Management

using System.Management;

 

public partial class Win_Win32_LogicalDisk : System.Web.UI.Page

{

    protected void Page_Load(object sender, EventArgs e)

    {

   ManagementObjectSearcher objlogic = new ManagementObjectSearcher("select * from Win32_LogicalDisk");

 

        foreach (ManagementObject obj in objlogic.Get())

        {

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

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

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

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

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

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

            Response.Write("----------------------------------------</br>");

        }

    }

}

Demo

View output :

demoimage


Please give your feedback for improving this page