title: Retrieve a List of Printers on the Network Using WMI, C#
body: <p>I've developed a printer search application that search for all online printers on the network. Im referring to this site - <a href="http://www.dotnetcurry.com/showarticle.aspx?ID=148" rel="nofollow">here</a></p>
  
  <p>The button event handler is something like:</p>
  
  <pre><code>private void btnGetPrinters_Click(object sender, EventArgs e)
      {
          // Use the ObjectQuery to get the list of configured printers
          System.Management.ObjectQuery oquery =
              new System.Management.ObjectQuery("SELECT * FROM Win32_Printer");
  
          System.Management.ManagementObjectSearcher mosearcher =
              new System.Management.ManagementObjectSearcher(oquery);
  
          System.Management.ManagementObjectCollection moc = mosearcher.Get();
  
          foreach (ManagementObject mo in moc)
          {
              System.Management.PropertyDataCollection pdc = mo.Properties;
              foreach (System.Management.PropertyData pd in pdc)
              {
                  if ((bool)mo["Network"])
                  {
                      cmbPrinters.Items.Add(mo[pd.Name]);
                  }
              }
          }
      }
  </code></pre>
  
  <p>but it's not working. I've debugged by line an found that the ((bool)mo["Network"]) cond. return false. Anyone have idea why this happen? I've checked my network and printers conn. It's all working fine. please advice.</p>