Solved

Printer Model detection via Script on Windows 7

Posted on 2011-02-10
5
626 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Ever notice how you can't use a new drive in Windows without having Windows assigning a Disk Signature?  Ever have a signature collision problem (especially with Virtual Machines?)  This article is intended to help you understand what's going on and…
Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
This Micro Tutorial will teach you how to change your appearance and customize your Windows 7 interface to your unique preference. This will be demonstrated using Windows 7 operating system.

746 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

16 Experts available now in Live!

Get 1:1 Help Now