Solved

how to list and map network printer in Active Directory using java

Posted on 2011-02-27
13
829 Views
Last Modified: 2013-11-24
hi,

is that possible to list network printers in AD and connect it to local machine when a button clicked?
I am wondering if this could be done in java. and if yes, can you please give me some ideas?

thanks
0
Comment
Question by:Ikelca
  • 6
  • 4
13 Comments
 
LVL 47

Expert Comment

by:for_yan
ID: 34993879
You can use Runtime.getRuntime.exec("net  view \\\\print_server_name");
0
 
LVL 47

Accepted Solution

by:
for_yan earned 334 total points
ID: 34993888

You can check this page which talks about it:

http://www.thatsjava.com/java-essentials/2240/

Then you need to capture output and anlyze it

Connect to local machine - that's next step you can do in the same
way using command
Runtime.getRuntime().exec("net use lpt: \\\\server_name\\printer")
0
 

Author Comment

by:Ikelca
ID: 34993945
it seems that link has no answers either, net view or net use commands are OS dependent.  
im wondering if there is any API that we can use.
0
Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

 
LVL 47

Expert Comment

by:for_yan
ID: 34993963


Java printing API does have a part which is called Printer discovery - maybe it will help:
http://java.sun.com/products/java-media/2D/forDevelopers/sdk12print.html
0
 
LVL 47

Expert Comment

by:for_yan
ID: 34993971

Stiil, I think in this API it will discover only local printer
0
 

Author Comment

by:Ikelca
ID: 34994005
so i guess there is no way to implement this idea in java ?
0
 
LVL 47

Expert Comment

by:for_yan
ID: 34994026
Well, never say never, maybe someone will still come up with some idea
Probably, for now if you just check the system and do some system specific discovery - maybe it is more practical
0
 

Author Comment

by:Ikelca
ID: 35019853
it seems only you and me here lol~~
0
 
LVL 47

Assisted Solution

by:for_yan
for_yan earned 334 total points
ID: 35020156
I guess you can RequestAttention.
Because once the question is a little bit old - and only those who chimed in before are
by default informed about, say, your additinal posting to it, so probability
someone else to rememeber is quite low.
I'm not sure,  as I'm rather new here myself,
but I think Request Attention may help to get more folks reminded
0
 
LVL 15

Assisted Solution

by:pcsmitpra
pcsmitpra earned 166 total points
ID: 35181803
Please view here , a similar script was discussed.
0
 

Author Closing Comment

by:Ikelca
ID: 35341462
cant find working solution, decided to go with c# instead of java
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Disabling the Directory Sync Service Account in Office 365 will stop directory synchronization from working.
When you try to share a printer , you may receive one of the following error messages. Error message when you use the Add Printer Wizard to share a printer: Windows could not share your printer. Operation could not be completed (Error 0x000006…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question