[Samba] installing printer in a logon script

Simon Hobson shobson-lists at colony.com
Mon Nov 8 14:34:20 GMT 2004

Tomasz Chmielewski wrote:

>My printer-install have to fulfil the following assumptions:
>1) printer is installed *fully* automatically - no end-user user interaction,
>2) as admin can reach Samba and only Samba remotely (and only 
>remotely), there can be no walking to a workstation and adding a 
>printer from there.
>To sum up:
>a) admin knows what printer do they have in these remote offices,
>b) admin copies drivers to samba remotely, changes some logon 
>scripts - and users of that remote office have printer drivers 
>It seems I could do it with "rundll32 printui.dll,PrintUIEntry ..." 
>- but I can construct a valid command to point to the drivers.
>I tried it like that:
>rundll32 printui.dll,PrintUIEntry /q /y /ga /if /f 
>\\server\shared\HP_2000C\hp_2x00c.inf /in /n \\server\HP_2000C
>But it seems to me that Windows is simply ignoring /if /f flags, 
>because it doesn't print any error (even with no /q) when I put some 
>nonsense instead of the location of the ini file.

Well here we just have :

rundll32 printui.dll,PrintUIEntry /in /n \\server\printer

in a script called from the login script. It seems to work fine for 
us except for the nice feature in XP SP1 that disables users from 
installing printers - we haven't got round to pushing out a registry 
hack to fix that yet, but before SP1 went on it worked.

As for adding print drivers to the server, we use cupsaddsmb (as per 
the Samba howtos).

So, we add a printer to cups, select the right PPD and put it in 
/etc/cups/ppd, then run cupsaddsmb to install the drivers. Add the 
rundll ... line to the login scripts, and next time a user logs in 
they get the printer installed (subject to the point and print policy 
in place).

This is with samba 2.2.8a-224 and cups 1.1.15-170 (current versions 
for Suse Linux Openexchange server).


Simon Hobson MA MIEE, Technology Specialist
Colony Gift Corporation Limited
Lindal in Furness, Ulverston, Cumbria, LA12 0LD
Tel 01229 461100, Fax 01229 461101

Registered in England No. 1499611
Regd. Office : 100 New Bridge Street, London, EC4V 6JA.

More information about the samba mailing list