Printer Model detection via Script on Windows 7

Hello!

I hope someone can help me achieve the following:

If you use the regular windows 7 add-printer routine from "Devices and Printers" and create a new port, then Windows can detect that printermodel and use an internal driver if available. I would like to know if I can perform that detection too using a script/commandline.

I'm building a HTA that provides the user with some basic local printer management features. The main reason for that is that the clients are migrating to a new trusted forest that doesn't have any published printqueues yet. This means that the standard Add printer from Directory isn't possible and there are many 1000's of shared printers in the environment so a little help there is required. Most printers are published in the printer resource forest(s) and can be resolved via IP in DNS too. This way I first determine the source-domains that a printer could be published in and the query that domain for that printQueue. If a published printer has been found I perform a connect network printer command and that all works fine, exept for those (few but incrasing number) printer-devices that have no Queue and should be setup as a local IP-port.

Right now I'll solve it by providing the users with a list of locally available drivers to choose from and then create the IP port and install the printer based on the selected driver, but I'd like to make it automatic.

I hope my story makes sense and someone can assist.

Thanks in advance.
Eric
evegterAsked:
Who is Participating?
 
ToxaconConnect With a Mentor Commented:
Then the easiest way could be using SNMP. Here's some help to use it from your own software or scripts:

http://www.codeproject.com/KB/cs/SNMPDLL.aspx
0
 
ToxaconCommented:
Use prnmngr.vbs which is comes with the OS. It can print the driver name which usually is the model as well. Other printer-managing scripts can be found in c:\Windows\System32\printer_admin_scripts\en-us.
0
 
evegterAuthor Commented:
Hello Toxacon,
thanks for your comments. I know of (and use) these default windows scripts and use parts of their code in my current HTA scripts. The scripts allow me to install ports, drivers, printers and share/publish them, all great, but the script does not 'scan' the remote IP-address to detect the printer I'm trying to install. As far as I know I can only install a 'local' printer by specifying the name of the printer identical to how it's written inside an INF file and specify the port to connect the printer to. It doesn't have an option to act like it does via the Add Printer GUI that performs a hardware detection...

I'll look further into it tomorrow and post comments.

Rgds,
Eric
0
 
evegterAuthor Commented:
thanks Toxacon! I don't think that I can introduce a custom dll very easily here, but at least you put me into the right direction and I'll dig into the snmp-discovery procedure.

Rgds,
Eric
0
 
evegterAuthor Commented:
it wasn't an exact solution, but the idea that was proposed did help me to find another approach for my problem.
0
All Courses

From novice to tech pro — start learning today.