Setting up Automatic Printer Driver Downloads for Windows Clients

Revision as of 15:17, 27 November 2016 by Hortimech (talk | contribs) (Setup the [print$] share: Replaced synonym)

Introduction

Windows Point'n'Print driver deployment is a process used by administrators, to upload and preconfigure drivers on a Windows/Samba print server. This allows users to simply connect a printer. The driver is downloaded from the print server automatically, installed (no need for local administrator permissions) and the preconfigured settings are applied.

In Windows 8/Server 2012, Microsoft introduced a the new printer driver model version 4, that is currently not supported by Samba. However, this doesn't mean newer Windows versions can't print via a Samba print server. All Windows versions (2000 up to 10 and Server 2000 to 2016) support the driver model version 3, support for this has been included in Samba for a long time. For further information on the driver model versions and the differences, see https://technet.microsoft.com/en-us/library/jj134171.aspx.

Important notes:

  • If you want to provide Point'n'Print support for drivers to be used on different architectures (typically 32-bit and 64-Bit Windows), you have to upload drivers with the same name for all the architectures! This is the only way to define the default printer settings just once on a platform of your choice. When the driver is downloaded to a host with a different architecture, these default values are used as well. However, this requires that the driver name is exactly the same for each platform. E. g. "HP Universal Printing PS" for x86 and "HP Universal Printing PS (v5.5.0)" for x64 wouldn't match, because of the different name! Choose exactly the same driver for all platforms that you want to support.
  • Drivers for x64, can only be uploaded from a x64 Windows! Drivers for the x86 architecture can be uploaded from 32- and 64-bit Windows.

In the following, we assume, that you have successfully setup Samba as a print server and a printer is already shared.



Granting print operator privileges

To be able to upload and preconfigure printer drivers, the relevant users and groups need to have been granted the "SePrintOperatorPrivilege" privilege. Due to this being a local setting, this is required on all print servers individually.

This is required on Samba Domain Members, because they have their own, local SAM database. It is recommended to grant the privilege to a domain group, so changes can be done centralized and easily by adding/removing users from that group without touching the print server. To view the current privilege list on a host, run

# net rpc rights list accounts -U'SAMDOM\administrator'

To grant SePrintOperatorPrivilege to the "Domain Admins" group, run

# net rpc rights grant 'Domain Admins' SePrintOperatorPrivilege -U'SAMDOM\administrator'
Enter SAMDOM\administrator's password:
Successfully granted rights.


Setup the [print$] share

To enable Point'n'Print support, a share named "[print$]" must exist. This share name is hard coded in Windows clients and can't be altered!

  • Add the share to your smb.conf
[print$]
       path = /srv/samba/Printer_drivers/
       comment = Printer drivers
       read only = no
  • Create the folder that will later contain the drivers:
# mkdir -p /srv/samba/Printer_drivers/
The subdirectory structure is created on the fly by Samba, when uploading drivers.
  • Set permissions on the filesystem of the share
It is recommended, that normal users have read-only access on the filesystem of the entire share, while the group granted the SePrintOperatorPrivilege to ("Domain Admins" in the example), is able to write to it. Permissions can be set using
Name Permissions Apply to
Creator Owner Full control Subfolders and files only
Authenticated Users Read & execute, List folder contents, Read This folder, subfolders and files
SYSTEM Full control This folder, subfolders and files
Domain Admins Full control This folder, subfolders and files
# chgrp -R "SAMDOM\Domain Admins" /srv/samba/Printer_drivers/
# chmod -R 2775 /srv/samba/Printer_drivers/

Uploading printer drivers for Point'n'Print driver installation

If you have already uploaded the driver for your printer in the past, you can skip this section.

The following steps are done on a 64-bit platform, because 64-bit Windows allows uploading drivers for x86 and x64:

  • Start the "Print Management" console (printmanagement.msc)
  • Expand the "Print Servers" node. If your print server isn't listed, add it by right-clicking / "Add/Remove Servers..."
File:Add Printserver.png
  • Navigate to "Drivers" below your print server. Right-click and choose "Add driver" to upload a new driver to your server
File:Print Management Add Driver.png
  • The "Add Driver" wizard will appear
  • Select the driver architecture you want to upload (upload one by one) and click "Next"
  • Click the "Have Disk..." button and browse to the directory containing the driver you want to upload
  • The wizard will show you a list of all drivers contained in the directory you pointed to. Select the appropriate driver for your printer and click "Next".
Remember: If you upload drivers for additional architectures for one printer, they all need to have exactly the same name! Otherwise the driver can't be associated and used with different platforms!
File:Printer driver selection.png
  • In the end, the wizard will copy all required files to the [print$] share of your print server
  • If you want to upload drivers for a different platform or other devices, repeat the steps
  • The drivers list in the Print Management Console provides you a list of drivers on your print server and for which platform they are available.
Print Management Driver List.png

Associating a shared printer with a driver and pre-configuration

  • Start the "Print Management" console (printmanagement.msc)
  • Expand the "Print Servers" node. If your print server isn't listed, add it by right-clicking / "Add/Remove Servers..."
File:Add Printserver.png
  • Navigate to the "Printers" node of your print server, to list all shared printers
File:View remote printers.png
  • You could do the association of the driver with the printer share on Windows or on *nix side:
  • On Windows:
  • Right-click to the shared printer, and choose "Properties"
  • If there's no driver associated with an printer yet, you'll be asked if you want to install the driver now. Answer this question with "No"!
File:Question install driver.png
  • A default printer properties window will appear. Go to the "Advanced" tab and choose the already uploaded driver from the list, that fits to your printer.
FAQ: An uploaded driver is not shown in the list, when trying to associate it with a printer.
File:Choose driver.png
Note: You may receive an "Printer settings could not be saved. Operation could not be completed (error 0x0000007a)" error. This can be ignored. The changes are saved anyway. See Bug #10482.
  • Close the windows with "OK" to save the changes
File:Question trust printer.png
  • After associating the driver, Windows renames the printer to the driver name. You can leave that or rename it back again. It is better to set the name on the Windows side rather than in smb.conf.
Note: Renaming the printer via the Printer Management console is only possible by editing the printers properties - not via [F2] (See Bug #10770).
  • On the Samba print server:
  • Retrieve a list of all drivers from the [print$] share
# rpcclient localhost -U administrator -c 'enumdrivers'
  • Associate the driver with the printer (The driver name, must be exactly the same as in the output of the above „enumdrivers“ output):
# rpcclient localhost -U administrator -c 'setdriver "MyDemoPrinter" "HP Universal Printing PS"'
  • You can review the associations with
# rpcclient localhost -U administrator -c 'enumprinters'
  • On Windows, now right-click and choose "Properties" again, to preconfigure the printer
  • First take a look on the tab names of the properties window. Typically there's a tab called "Device Settings", "Settings", "Configuration" or something similar (depending on the driver). The tab usually allows configuration of the main printer settings (number of trays, duplex on/off, etc.). Set the values fitting to your device and click the "Apply" button.
File:Device Settings.png
  • On the "Sharing" tab, you can check "List in the directory", to publish the printer in your Active Directory, which makes it easier for users to find.
  • To preconfigure the printers default settings, go to the "Advanced" tab and click the "Printing defaults..." button. A new window will appear. It's layout and possibilities differ and depend on the driver. Here you set the default values that the user will receive, when connecting the printer.
File:Printing defaults.png
  • To save the changes, click "OK"

If you have uploaded drivers for multiple architectures for the printer, the correct settings will be retrieved for the platform - regardless on which they have been set. However as mentioned earlier, this requires that all drivers for each platform have the same name.



FAQ

An uploaded driver is not shown in the list, when trying to associate it with a printer

Windows clients only permit associating a driver with a printer, when the uploaded driver matches the architecture reported by the spoolss server. Samba reports "Windows NT x86" by default. This means that if you have only uploaded a 64-bit driver, you won't see it in the list when you try to associate it with the printer in it's "Advanced" tab. There are three ways to workaround:

  • Set the following (undocumented) parameter in your [global] section of your smb.conf, to make spoolss announce itself as x64 architecture:
spoolss: architecture = Windows x64
  • Assign the driver with rpcclient.
  • Additionally upload a x86 version of the driver with exactly the same name.


Point'n'Print doesn't deliver the drivers on all architectures

Make sure that you have uploaded exactly the same driver for that printer for all architectures. E. g. "HP Universal Printing PS" for x86 and "HP Universal Printing PS (v5.5.0)" for x64 wouldn't match, even if they are shipped in the same driver package!


Printer driver error "The folder you specified doesn't contain a compatible software driver for your device"

If you receive the error "The folder you specified doesn't contain a compatible software driver for your device" when selecting an inf file for driver upload, you're likely hitting the following: Incompatible Printer Driver Architecture.