17.10 Adding Network Printers without User Interaction

17.10 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 , (http://support.microsoft.com/default.aspx?scid=kb;en-us;189105 [3] ). It also applies to Windows XP Professional clients. The ideas sketched out in this section are inspired by this article, which describes a commandline 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 ):

[3] http://support.microsoft.com/default.aspx?scid=kb;en-us;189105

 rundll32 printui.dll,PrintUIEntry /? 

A window pops up that shows you all of the commandline switches available. An extensive list of examples is also provided. This is only for Win 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 commandline 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 eliminates 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 auto-downloaded 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 re-start of smbd after the printer install and the driver upload, otherwise the script (or any other client driver download) would fail.

Since there no easy way to test for the existence of an installed network printer from the logon script, do not bother checking, just allow the deinstallation/reinstallation 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 into 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).

Official Samba-3 HOWTO and Reference Guide
The Official Samba-3 HOWTO and Reference Guide, 2nd Edition
ISBN: 0131882228
EAN: 2147483647
Year: 2005
Pages: 297

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net