Jitesh Byahut 2/16/2014 2862

Win32_Printer in WMI C# Asp.Net

Here we are retrieving Printers details of Computer.

Use namespace System.Management

using System.Management;

 

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

{

    protected void Page_Load(object sender, EventArgs e)

    {

     ManagementObjectSearcher objprinter = new ManagementObjectSearcher("select * from Win32_Printer");

 

        foreach (ManagementObject obj in objprinter.Get())

        {

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

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

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

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

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

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

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

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

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

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

        }

    }

}

Demo

View output :

demoimage


Please give your feedback for improving this page