Jitesh Byahut 2/16/2014 2676

Win32_DiskDrive in WMI C# Asp.Net

Here we are retrieving drives details of Computer.

Use namespace System.Management

using System.Management;

 

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

{

    protected void Page_Load(object sender, EventArgs e)

    {

 ManagementObjectSearcher objdiskdrive = new ManagementObjectSearcher("select * from Win32_DiskDrive");

 

        foreach (ManagementObject obj in objdiskdrive.Get())

        {

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

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

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

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

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

        }

    }

}

Demo

View output :

demoimage


Please give your feedback for improving this page