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  ). 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 ):
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
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:
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).