Solved

Correct Syntax required for Local Printer install using PRINTUI.DLL

Posted on 2007-03-30
7
1,307 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
HP DesignJet 755CM driver 3 62
Not Replacing Printer Drum 9 42
Unable to connect to printer 6 63
laser color wireless scan to email 16 60
Printers have changed substantially in the last 30 or so years, not just in technical capabilities but in cost and usage as well.  Printers were originally used for interfacing with the operator, not necessarily for printing copy or pictures. In …
Monitor input from a computer is usually nothing special.  In this instance it prevented anyone from using the computer.  This was a preconfiguration that didn't work.
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.

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

14 Experts available now in Live!

Get 1:1 Help Now