Discussion:
How to enumerate network printers
(too old to reply)
Jim Howard
2005-11-28 19:00:49 UTC
Permalink
Howdy,

I need to be able to enumerate all the visible hosts on a windows
network and list all their printers, in the same way that the windows
add printer wizard does.

I have no problem listing printers that have already been installed on
the local machine using both WMI and the GetPrinter/OpenPrinter APIs.

My question is how to enumerate all hosts with printers visible on the
windows network but not installed on the computer running my software.

thanks

Jim Howard
AliR
2005-11-28 19:20:33 UTC
Permalink
Take a look at NetServerEnum to find all the workstations and/or servers on
the network.
Take a look at NetShareEnum(...) function to find the printers for each
Server you find. Level 2 and above will give you the info that you want.
(here the word server doesn't necessarily mean a server, it could be a
workstation)

AliR.
Post by Jim Howard
Howdy,
I need to be able to enumerate all the visible hosts on a windows
network and list all their printers, in the same way that the windows
add printer wizard does.
I have no problem listing printers that have already been installed on
the local machine using both WMI and the GetPrinter/OpenPrinter APIs.
My question is how to enumerate all hosts with printers visible on the
windows network but not installed on the computer running my software.
thanks
Jim Howard
Jim Howard
2005-11-28 20:58:25 UTC
Permalink
Thanks a bunch, that's the clue I need.

Jim
Post by AliR
Take a look at NetServerEnum to find all the workstations and/or servers on
the network.
Take a look at NetShareEnum(...) function to find the printers for each
Server you find. Level 2 and above will give you the info that you want.
(here the word server doesn't necessarily mean a server, it could be a
workstation)
AliR.
Post by Jim Howard
Howdy,
I need to be able to enumerate all the visible hosts on a windows
network and list all their printers, in the same way that the windows
add printer wizard does.
I have no problem listing printers that have already been installed on
the local machine using both WMI and the GetPrinter/OpenPrinter APIs.
My question is how to enumerate all hosts with printers visible on the
windows network but not installed on the computer running my software.
thanks
Jim Howard
Jim Howard
2005-11-29 16:06:43 UTC
Permalink
Post by AliR
Take a look at NetServerEnum to find all the workstations and/or servers on
the network.
Alir & group,

By combining the MSDN examples for NetServerEnum and NetShareEnum I was
able to write a program that does enumerate the computers and printers
on the network.

The only problem I'm having now is that my program only enumerates
computers that are in the host computers own workgroup. Computers in
other workgroups are not enumerated.

Jim
Post by AliR
Take a look at NetShareEnum(...) function to find the printers for each
Server you find. Level 2 and above will give you the info that you want.
(here the word server doesn't necessarily mean a server, it could be a
workstation)
AliR.
Post by Jim Howard
Howdy,
I need to be able to enumerate all the visible hosts on a windows
network and list all their printers, in the same way that the windows
add printer wizard does.
I have no problem listing printers that have already been installed on
the local machine using both WMI and the GetPrinter/OpenPrinter APIs.
My question is how to enumerate all hosts with printers visible on the
windows network but not installed on the computer running my software.
thanks
Jim Howard
Loading...