Solved

Correct Syntax required for Local Printer install using PRINTUI.DLL

Posted on 2007-03-30
7
1,309 Views
Last Modified: 2013-12-15
When I go to install the printer instead of choosing Network printer, I choose local printer, and then choose create new local port, which i point to the network printer. ie. \\10.42.110.14\printer1 this then lets me select a printer driver from the list. However I would like to do this using the Rundll32 PrintUI.dll but I don't know the correct syntax. I need to add 6 printers all of them are hp printers and some share the same driver which automatically comes with hp. Therefore can some one tell me the exact syntax I need to install the following printer: From this I'll be able to install the rest

Printer Name: printer1.
Local Printer Address: \\10.42.110.14\printer1
Driver HP Laserjet 4V/4MV PostScript

Many Thanks
0
Comment
Question by:jasgrif11
  • 3
  • 2
7 Comments
 
LVL 3

Expert Comment

by:drbayer
ID: 18823152
Here's a good reference site for printui.dll: http://www.dx21.com/SCRIPTING/RUNDLL32/VIEWITEM.ASP?OID=145&CMD=P-A

Another option is to use a quick vbscript - something like:

set oNet = createobject("wscript.network")
oNet.addwindowsprinterconnection "\\10.42.110.14\printer1"
oNet.addwindowsprinterconnection "\\10.42.110.14\printer2"
oNet.setdefaultprinter("\\10.42.110.14\printer1")

Just put in as many addwindowsprinterconnection lines as you need, and only use the setdefaultprinter line if you want to specify which is the default.  If you need the printer to be available at the DOS level, use addprinterconnection and specify the port.
0
 
LVL 38

Expert Comment

by:hdhondt
ID: 18833671
Have a look at this Microsoft Knowledge Base document:

http://support.microsoft.com/kb/314486
0
 

Author Comment

by:jasgrif11
ID: 18835248
I had a look at the Microsoft Knowledge document however this describes how to add a printer using a tcp/ip port. Will the rundll32 printui.dll utility work to add a local port ie. \\10.42.110.12\printer1 if so whats the exact syntax I need. I want to be able to add 6 printers all at once rather then going through the gui.I will also need to add these printers to multiple computers
0
Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

 
LVL 38

Expert Comment

by:hdhondt
ID: 18835763
The link does show how to create a local TCP/IP printer:

rundll32 printui.dll,PrintUIEntry /if /b "Test Printer" /f
%windir%\inf\ntprint.inf /r "IP_157.57.50.98" /m "HP Laserjet 4000 Series PCL" /Z
0
 

Author Comment

by:jasgrif11
ID: 18836223
So if I use the following command it should work fine??

rundll32 printui.dll,PrintUIEntry /if /b "Printer 1" /f%windir%\inf\ntprint.inf /r "IP_10.42.110.12\printer1" /m "HP Laserjet 4V/4MV PostScript " /Z

How do I find the correct .inf file? can i get it from a system that already has the printer installed? Also is it possible to automatically set the print to print A4 and not letter?
0
 
LVL 38

Accepted Solution

by:
hdhondt earned 500 total points
ID: 18847449
Sorry I have not got back to you for a while.

You should be able to point rundll32 at a server or another PC that has the .inf installed, by adding the hostname (or drive letter) before the %windir% parameter.

As for forcing driver settings, try the following 2 commands (from drbayer's link):

Store all printer settings (from an existing printer) into a file:
rundll32 printui.dll,PrintUIEntry /Ss /n "printer" /a "file.dat"

Restore all printer settings from a file:
rundll32 printui.dll,PrintUIEntry /Sr /n "printer" /a "file.dat"
0

Featured Post

Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

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

Suggested Solutions

This article may be useful for troubleshooting your PC. Power Supply - no lights or fans running If you have no lights or fans running then either you power is bad, turned off (check switch) or the power supply needs to be replaced. That's a r…
When you try to share a printer , you may receive one of the following error messages. Error message when you use the Add Printer Wizard to share a printer: Windows could not share your printer. Operation could not be completed (Error 0x000006…
The viewer will learn how to successfully download and install the SARDU utility on Windows 8, without downloading adware.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

856 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