473,387 Members | 1,790 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

List of UNC Paths to networked printers

1
Can anyone tell me how to get a list of full UNC paths for all printers on a network?

I have tried using WMI but the following code only gives me a list of local printers, and doesn't give me the fully qualified paths.
Expand|Select|Wrap|Line Numbers
  1. private void GetNetworkPrinters()
  2.         {
  3.             try
  4.             {
  5.  
  6.                 string strQuery = "SELECT * FROM Win32_Printer";
  7.  
  8.                 ObjectQuery objectQuery = new ObjectQuery(strQuery);
  9.                 ManagementScope scope = new ManagementScope("\\\\" + EMServer.UserConsole.ApplicationEnvironment.RemoteServerID + "\\root\\cimv2");
  10.                 ManagementObjectSearcher query = new ManagementObjectSearcher(scope, objectQuery);
  11.                 ManagementObjectCollection printers = query.Get();
  12.  
  13.                 foreach (ManagementObject printer in printers)
  14.                 {
  15.                     PropertyDataCollection propertyDataCollection = printer.Properties;
  16.                     this.cboPrinter.Items.Add("\\\\" + printer["Location"] + "\\" + printer["Name"]);
  17.                 }
  18.             }
  19.             catch (Exception ex)
  20.             {
  21.                 MessageBox.Show(ex.Message);
  22.             }
  23.         }
  24.  
Thanks

Drewgy
Mar 2 '09 #1
0 1352

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Mike Tammerman | last post by:
Hi, I want to get the printer list from CUPS. I found some ways using lpstat -p and http://localhost:631/printers but, these ways require some parsing and I am not sure, if the parsing...
0
by: martin | last post by:
Hi, On my development machine I have vs.net installed and I am able to create a web application project No problem, this is located at http://localhost which I am guessing is the default. we...
0
by: Dexter | last post by:
Hello all, I need to list in a dropdownlist, all network printers. I have a server with 6 printers, and I need to do a direct print at printer that the user to select in a dropdownlist. ...
2
by: J | last post by:
Hello, I'm using the following snippet of code to try and get a list of all the printers installed on this machine. I have installed some network printers on this machine and they just won't...
1
by: gnusmsa | last post by:
ASP.NET 2.0 (C#) application Using Windows authentication and impersonation Windows Server 2003 (IIS6) Server is a member server on a domain Logged into server as a domain user that is in the...
0
by: Ravigwipro | last post by:
Hi, I m able to get the printers object to know what are the printers had been installed and all. here my requirement is i have to write a data from VB to MS Word. for the page setup i have to...
2
by: smartic | last post by:
i'm having three lists when i select from any one the others be visible by hierarchy but it takes to long to write my code is there is another away to write this code like XML that is my javascript...
4
by: Luqman | last post by:
I am using Visual studio 2008 and ASP.Net 3.5 How can I fill a combo with List of Local Printers, installed on Client Machine ? If I have to buy any Activex Control from Internet, please do...
4
by: Frank Rizzo | last post by:
I basically need a list of printers that's returned by the Find Printers dialog ( http://www.sqleffects.com/mystuff/findPrinters.png ). I've tried the path of DirectoryEntry entry = new...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.