Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Samba HowTo Guide
Prev Home Next

Adding Network Printers without User Interaction

The following MS Knowledge Base article may be of some help if you need to handle Windows 2000 clients: How to Add Printers with No User Interaction in Windows 2000, ( Microsoft KB 189105). It also applies to Windows XP Professional clients. The ideas sketched out in this section are inspired by this article, which describes a command-line method that can be applied to install network and local printers and their drivers. This is most useful if integrated in Logon Scripts. You can see what options are available by typing in the command prompt ( DOS box ):

rundll32 printui.dll,PrintUIEntry /?

A window pops up that shows you all of the command-line switches available. An extensive list of examples is also provided. This is only for Windows 200x/XP; it does not work on Windows NT. Windows NT probably has some other tools in the respective Resource Kit. Here is a suggestion about what a client logon script might contain, with a short explanation of what the lines actually do (it works if 200x/XP Windows clients access printers via Samba, and works for Windows-based print servers too):


rundll32 printui.dll,PrintUIEntry /dn /n "\\cupsserver\infotec2105-IPDS" /q


rundll32 printui.dll,PrintUIEntry /in /n "\\cupsserver\infotec2105-PS"


rundll32 printui.dll,PrintUIEntry /y /n "\\cupsserver\infotec2105-PS"

Here is a list of the used command-line parameters:

/dn

deletes a network printer.

/q

quiet modus.

/n

names a printer.

/in

adds a network printer connection.

/y

sets printer as default printer.

  • Line 1 deletes a possibly existing previous network printer infotec2105-IPDS (which had used native Windows drivers with LPRng that were removed from the server that was converted to CUPS). The /q at the end prevents confirm or error dialog boxes from popping up. They should not be presented to the user logging on.

  • Line 2 adds the new printer infotec2105-PS (which actually is the same physical device but is now run by the new CUPS printing system and associated with the CUPS/Adobe PS drivers). The printer and its driver must have been added to Samba prior to the user logging in (e.g., by a procedure as discussed earlier in this chapter or by running cupsaddsmb ). The driver is now autodownloaded to the client PC where the user is about to log in.

  • Line 3 sets the default printer to this new network printer (there might be several other printers installed with this same method, and some may be local as well, so we decide for a default printer). The default printer selection may, of course, be different for different users.

The second line only works if the printer infotec2105-PS has an already working print queue on the cupsserver and if the printer drivers have been successfully uploaded (via the APW , smbclient/rpcclient , or cupsaddsmb ) into the [print$] driver repository of Samba. Some Samba versions prior to version 3.0 required a restart of smbd after the printer install and the driver upload; otherwise the script (or any other client driver download) would fail.

Since there is no easy way to test for the existence of an installed network printer from the logon script, do not bother checking. Just allow the de-installation/re-installation to occur every time a user logs in; it's really quick anyway (1 to 2 seconds).

The additional benefits for this are:

  • It puts in place any printer default setup changes automatically at every user logon.

  • It allows for “roaming” users' login to the domain from different workstations.

Since network printers are installed per user, this much simplifies the process of keeping the installation up to date. The few extra seconds at logon time will not really be noticeable. Printers can be centrally added, changed, and deleted at will on the server with no user intervention required from the clients (you just need to keep the logon scripts up to date).

Samba HowTo Guide
Prev Home Next

 
 
  Published under the terms fo the GNU General Public License Design by Interspire