Jump to content

Finding out which network printers are connected?


Recommended Posts

Hello *.* :ph34r:

is there a way to find out which network printer connections currently exists?

For example I wanna know if comp is allready connected to "HPLASERJET", "MINOLTA_BOSS" etc..

I tried AutoIT together with cmd net use, but net use only tells me about connected

network printers that have a lpt port assigned. But I need to know that for printers without such an assigment, too.

I would like to do this without any external programms that I´ve to install seperatly.Commands like net that are avaible on every Win2000/XP Pro comp are o.k.

I searched the registry for entries about the currently connected printers, but I was not successfull

Any suggestions?

Commenti

Link to comment
Share on other sites

Hi ezzetabi (oh, this name seem famliar, think I have read this name today bevore :ph34r: )

Hm, at least at my comp at work it did not show the connection to the shared printers that had no lpt port assigned. Perhaps something with my comp is wrong?

I´ll try to find out tommorow on different computers if it is there is the same. All computers are connected to a domain, the printers are connected to the Domain-Server over the network with print severs and are shared. Clients are XP-Pro and W2K-Pro.

commenti

Link to comment
Share on other sites

Hello again,

net view does not work for this. I tried it out again at work. So I need another solution to find out which network printers are currently connected to the maschine.

Perphaps someone has another idea?

commenti

Link to comment
Share on other sites

Printer information resides in the registry. Search MIcrosoft for "Microsoft Knowledge Base Article - 102966"

You can then use Autoit to query the registry, local of remote

$var = RegRead("\\computername\HKEY_LOCAL_MACHINE\etc")

Cheers

Nobby

CheersNobby

Link to comment
Share on other sites

Hello,

thank you all for your help. Especially nobby´s point to MS Knowlegebase Art. 109266" was helpfull.

I still did not find were the I can see to which network printershares the maschine is currently connnected using the $share names e.g. \\hplaser I can´t find anywhere. But under HKEY_CURRENT_USER\Printers\Connections (thanks sugi) there are the long names of the connected printers e.G. Server,HP LaserJet 6P_first_floor.

Because it is possible to connect to a printer using this long names, too I can now do what I need with this.

Still wondering, why I could not find the shorter $printershare names.

But again, thank you all!

commenti

PS: With this info, I think it will not be long ´till I can post my collected "UDFs for login scripts" in "scripts and scraps". They are working but my "addprinterconnection" and "delteprinterconnection" functions are a little slow. With the gained info I think I can improve this.

Functions ready, allready working so far:

settime // sync time with server

netusedel // del mapped network drive connection

netuseadd // add mapped network drive connection

delprinterconnection // delnetworkprinterconnection

addprinterconnection // addnetworkprinterconnection

ingroup // finds out if a user is in a given group

setuserenv // sets enviroment for the currently loggend in user

Perhaps someone else is interessted in these functions? (for use in loginscripts with W2K and W-XP Pro Clients).

Link to comment
Share on other sites

In my case there's ",,FHHSPRINT01,FHHPN070" which is the share name. You only have to substitue , by \

I'm interested in the "ingroup" function... How did you manage to read the list of groups? Did you use ifmember.exe?

Edited by sugi
Link to comment
Share on other sites

Hi sugi,

if I search for \hplaser oder ,hplaser in the registry I don´t find the current connections. I find hplaser perhaps, but even then if it is no more connected.

The reg key with the full name is allways up to date.

The ingroup function you can find here it was my first udf: http://www.autoitscript.com/forum/index.php?showtopic=3597

I did not use "ifmember.exe" I used "net user" because this has not to be extra installed (or fileinstalled) on every Win2K/WinXP maschine I have to manage.

The net command should allways avaible there. One warning: The udf is only tested on german versions of XP and W2K but it should work with other languages, too.

commenti

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...