Although there are a number of methods and tools to maintain print-driver replication amongst Xenapp servers, the main objective is to keep your drivers in sync with your print-server. Setting up a Xenapp farm means that users don’t have the right to add print-drivers. And so even when the most piddling DLL deviates from your print server your users are presented with malignant looking windows demanding all sorts of admin stuff. Can your hear the phone ringing at the service desk…?
Even though best practice tells us to use Citrix Universal Print Server, using proprietary drivers is hardly avoidable. Now Citrix offers two methods: Using Powershell and using the Print Management Administrative Tool. The first is explained extensively, but the latter hardly. While I think this is the perfect tool to make syncing of printer-drivers between printserver and Xenapp server easy and fool proof.
Of course we’re not gonna use the GUI but the CLI tool underneath: the printbrm.exe This little bugger is gonna sync our print-drivers. Besides a Windows 2008 R2 print server, a prerequisite is the installation of RSA tools for print management. Using Powershell, the installation is done fairly easy.
Import-Module Servermanager Add-WindowsFeature RSAT-Print-Services
A drawback of using the GUI is that it won’t let you export drivers only. You’ll end up with an export file containing printers, ports & drivers. Let’s have a look at the script which will export just those drivers.
****Create Export PrintServer file****
c:\windows\system32\spool\tools\printbrm -B -F C:\PrnDrv_Export\PrnDrvEx.printerexport
rem ****Expand Export PrintServer objects****
c:\windows\system32\spool\tools\printbrm -R -D c:\PrnDrv_Export -f c:\PrnDrv_export\PrnDrvEx.printerexport
rem ****Remove Printers & Ports****
xcopy C:\PrnDrv_Export\import\*.xml C:\PrnDrv_Export /C /Y
rem ****Copy import file to Sources****
c:\windows\system32\spool\tools\printbrm -B -D C:\PrnDrv_Export -F C:\PrnDrv_Export\PrnDrvIm.printerexport
rem ****Clean up****
del C:\PrnDrv_Export\Printers\*.xml /F /Q
del c:\PrnDrv_Export\*.xml /F /Q
del c:\PrnDrv_Export\PrnDrvEx.printerexport /F /Q
del c:\PrnDrv_Export\Drivers\*.* /S /F /Q
del c:\PrnDrv_Export\LMONS\*.* /S /F /Q
del c:\PrnDrv_Export\Printers\*.* /S /F /Q
del c:\PrnDrv_Export\PRTPROCS\*.* /S /F /Q
Basically what it does is:
- Export printers, ports & drivers to an export file
- Expand the export file
- Replaces the printer & port XML files with empty ones
- Compress the content back to an export file without printer-objects and port-objects
- Clean up
As you can see, the script requires a folder structure to be present on the print server. For your convenience I added a zip-file containing this folder structure, including the necessary XML files. Unzip this in the root of the C:\ drive of your printserver.
After copying the export file to a central place on your network it’s an easy job to deploy it to your Xenapp servers. Your Xenapp servers need to have the RSAT Print Management feature installed as well.
c:\windows\system32\spool\tools\printbrm -R -F %drive%\PrnDrvIm.printerexport -O Force
Using the printbrm tool each time you make a change on your printerserver will give you the assurance that you’ll have exactly the same set of print-drivers on your Xenapp servers present. Using tools like RES Automation Manager or MS System Center makes it even easier to import and export the printerexport files from the printserver to your Xenapp server.