Solved

Printer Model detection via Script on Windows 7

Posted on 2011-02-10
5
637 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
You may have a outside contractor who comes in once a week or seasonal to do some work in your office but you only want to give him access to the programs and files he needs and keep privet all other documents and programs, can you do this on a loca…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…

749 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