Solved

Correct Syntax required for Local Printer install using PRINTUI.DLL

Posted on 2007-03-30
7
1,305 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
Comment Utility
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:Herman D'Hondt
Comment Utility
Have a look at this Microsoft Knowledge Base document:

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

Author Comment

by:jasgrif11
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 38

Expert Comment

by:Herman D'Hondt
Comment Utility
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
Comment Utility
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:
Herman D'Hondt earned 500 total points
Comment Utility
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This seems to be a very common error related to the Samsung printer driver. First, this is the error we're talking about: Log: System Type: Error Event: 7000 Agent Time: 3:37:24 am 22-Apr-09 Event Time: 6:07:24 pm 21-Apr-09 UTC Source: Se…
Causes of paper jams:The following are the main causes of paper jams. Guides:If the guides for the paper are not set correctly they may cause the paper to enter at an angle. You should ensure that the guides are set correctly for the paper type a…
The viewer will learn how to successfully download and install the SARDU utility on Windows 8, without downloading adware.
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

743 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

18 Experts available now in Live!

Get 1:1 Help Now