Solved

Printer Model detection via Script on Windows 7

Posted on 2011-02-10
5
631 Views
Last Modified: 2012-05-11
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
0
Comment
Question by:evegter
  • 3
  • 2
5 Comments
 
LVL 8

Expert Comment

by:Toxacon
ID: 34865156
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
 

Author Comment

by:evegter
ID: 34866826
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
 
LVL 8

Accepted Solution

by:
Toxacon earned 500 total points
ID: 34868798
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
 

Author Comment

by:evegter
ID: 34868962
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
 

Author Closing Comment

by:evegter
ID: 34868969
it wasn't an exact solution, but the idea that was proposed did help me to find another approach for my problem.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By default the complete memory dump option is disabled in windows . If we want to enable the complete memory dump for a diagnostic purpose, we have a solution for it. here we are using the registry method to enable this.
On some Windows 7 (SP1) computers, Windows Update becomes super slow even the computer is reasonably fast.  There's one solution that seemed to have worked well for me (after trying a few other suggested solutions).
This Micro Tutorial will teach you how to the overview of Microsoft Security Essentials. This is a free anti-virus software that guards your PC against viruses, spyware, worms, and other malicious software. This will be demonstrated using Windows…
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now