Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detecting the presence of a printer on a server

Status
Not open for further replies.

Slarti

Programmer
Feb 5, 2003
45
GB
I'm trying to confirm the presence of a printer on a server. I have an array of servers and intend looping through them using a function such as FileExists to identify where the printer is. Is there such a function as PrinterExists and if so what references do I need?

TY.
 
I use this. In this example I'm looking for a printer called TPA.

For Each prn In Printers
If prn.DeviceName Like "*TPA*" Then
Set Printer = prn
Exit For
End If
Next

That will give you:

prn.DriverName
prn.DeviceName
prn.Port
 
Thanks TysonLPrice that's certainly helped. However it only checks the printers set up on my base. I'm on a base on one server but have access to 15 or so servers that I'd like to search for a printer regardless of whether it's set up on my base or not.
 
You will need to enumerate all of the printers on each server to do this. Check into the WNetOpenEnum and WNetEnumResource API's to get you started.

I know I've seen examples right here in this forum before. See thread222-47242 for starters.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top