Printer Problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • TARUN

    #1

    Printer Problem

    Hello All,



    I need to get the list of printer installed in my system,
    the printer can be a network printer also,

    I am using the System.Manageme nt namespace.
    here is the code

    string printerName = "";
    ManagementScope mgmtscope = new ManagementScope (@"\root\cimv2" );
    mgmtscope.Conne ct();
    ManagementObjec tSearcher objSearcher = new
    ManagementObjec tSearcher("Sele ct * from Win32_Printer") ;

    foreach (ManagementObje ct printerRef in
    objSearcher.Get ())
    {
    printerName = printerRef["Name"].ToString();
    }

    The problem i am facing is that ,

    The above code get me the list of all the printer installed in my
    system along with network printer, but this code is working on only my
    machine, when i use the same code in different machine, the code gives
    me the list of only those printer which are already installed, but
    when i add new network printer,my code is not returning the name of
    new printer.

    Please suggest me , where i am going wrong.

    Thank's

Working...