Print server

  • Thread starter Thread starter Marc Robitaille
  • Start date Start date
M

Marc Robitaille

Hello,

Is there a way of having the list of the printers install on a print server
by code? I would like to build a list of these printers and to add this list
in a drop-down list in my client application. I search on the web but I did
not find anything.

Thank you for your help
 
I found how to do it. One of my coworker tell me to look in the active
directory. So if others whant to know how to do it, here is the code.

Don't forget to change these values to your need :
'LDAP://DC=DomaineName,DC=com'

Dim oConnexion As New OleDbConnection("Provider=ADsDSOObject;")
oConnexion.Open()
Dim oCommand As New OleDbCommand("SELECT printerName, serverName FROM " & "
'LDAP://DC=DomaineName,DC=com' WHERE objectClass='printQueue'", oConnexion)
Dim oDataAdapter As New OleDbDataAdapter(oCommand)
Dim oDataSet As DataSet = New DataSet
oDataAdapter.Fill(oDataSet)
Dim oRow As DataRow
ListBox1.Items.Clear()
For Each oRow In oDataSet.Tables(0).Rows
ListBox1.Items.Add(oRow.Item(1).ToString + " on " + oRow.Item(0).ToString)
Next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top