0

Hi i have a method that gets a printer list from the network and fill my drop-down list:

 private void fillprinterslist()
{
System.Management.ManagementScope objMS =
               new System.Management.ManagementScope(ManagementPath.DefaultPath);
    objMS.Connect();

    SelectQuery objQuery = new SelectQuery("SELECT * FROM Win32_Printer");
    ManagementObjectSearcher objMOS = new ManagementObjectSearcher(objMS, objQuery);
    System.Management.ManagementObjectCollection objMOC = objMOS.Get();

    foreach (ManagementObject Printers in objMOC)
    {
        if (Convert.ToBoolean(Printers["Network"]))     // ALL NETWORK PRINTERS.
        {
            DropDownList3.Items.Add(Printers["Name"].ToString());
        }
    }
}

not all network printers are getting filled in the drop down list, for example i have an zebra label printer in the next room that i am using as a test for this project and it does not show up in the drop down list

the printer is located on:

\ksmsv010\kcmzbl63

In my drop down list i am able to see other printers that are not Zebra Printers

**how do i only list the zebra printers from all servers?? **

from what information i had all the zebra printers have "zbl" common in the naming convention so i dont know if we can filter based on those 3 letter.

Please help thanks!!!!

2
  • Side note: Enumerating remote objects server side is generally pain as you hit with one-hop restrictions to authentication... Also make sure you are actually interested in enumeration of printers visible from server... May 26, 2015 at 21:32
  • @AlexeiLevenkov but this is still from my local machine. i know that when this projects gets hosted on to IIS its going to screw me over with permissions on those printers but from my local machine it is still not retrieving all the printers... May 26, 2015 at 22:00

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.