I have been trying to find all printers in the network.But, I always ended up with printers which are already connected with my computer. When I try to add printers at Control Panel\Hardware and Sound\Devices and Printers, I could find many more printers available in the network.
Please note that I don't have printer server. All printers are IP based.
I used following code:
WqlObjectQuery wQuery = new WqlObjectQuery("SELECT * FROM Win32_Printer Where " +
"Local = FALSE");
ManagementObjectSearcher res = new ManagementObjectSearcher(wQuery);
if ((res.Get().Count > 0))
{
foreach (ManagementObject printer in res.Get())
{
Console.WriteLine(printer["PortName"] + " : " + printer["DriverName"] +
" : " + printer["Status"]);
}
}
else { Console.WriteLine("No printers found"); }
In the query, if I set local to true i get printers installed on my computer.
I also tried with similar questions here, but still no luck.
Any help appreciated.