Deploying Printer Drivers for Citrix XenApp

Printers and printer drivers aren’t an exiting technology as the latest HDX Features in XenApp 7.12 and so on. But every Citrix admin out there has ran into issues with printers and printer drivers at one point or another. And we’ve all been felt the same need at least once: how do I get those print drivers out there without breaking everything?

Sure, XenApp 6.5 has had a driver replication feature for a long time, but that isn’t without flaws… So I wanted something different, something where I was in control.

I’ve become a fan of Admin Arsenal’s PDQ Deploy some time ago, so I designed my solution with that in mind. It should work with other software deployment tools and even manually it would all just work. In case this is the first time you’ve heard about PDQ Deploy, I strongly encourage you to have a look at www.adminarsenal.com.

I needed a way to install the print driver on remote machines, not map a printer, not creating a printer port, … just keep it simple: install the print driver, nothing else.

The scenario I had in mind was quite clear. Every print driver comes with an INF file with driver descriptions etc and every Windows version since Windows 2000 has a built-in utility called printui which can be used to install printers, drivers and ports. The printui tool needs the INF file and the exact driver name as stated in that file to work. So my idea had to consist of 2 parts:

  1. Select the right printer model out of the INF file
  2. Parse that INF file together with that printer model to printui, on the target machine.

So I started creating PowerShell scripts for both parts. I’m not a PowerShell guru by any means, so if the code doesn’t look as slick or clean as it could, that’s on me and my coding “skills”.

The simple scenario grew and turned into this:

  1. Launch script “PrintModelSelector”.
  2. This script will prompt for the INF file to process.
  3. It will present a list of Printer Models it finds and prompts to select one.
  4. The name of the Printer Model is saved together with the INF file name into a CSV file in the same directory as the INF file (so: where the driver is really).
  5. The second script “PrintDriverDeploy” will read that CSV file and parse info to printui, actually installing the print driver.

INF file processing turned out to be a hard one, and my solution works but is not perfect. For those situations, the download will include a sample PrintDriverDeploy script and CSV file you can adapt for those cases it doesn’t work. I’ve tested with quite a number of INF files, and recent ones all worked as expected. Some old exotic ones didn’t but that can be fixed manually.

The final stage of my “project” was to create the PrintDriverDeploy script at runtime. What I mean by this is that the first script creates not only the CSV file, but also the script to parse that file, both in the same location as the selected INF file.

Going back to my PDQ Deploy story, that’s the script I would be deploying in the Package.

pdqdeploy_package

Tip: make sure to select the “Include Entire Directory” option, as you’ll need to push all driver files to the target device.

As I’m running the free version of PDQ Deploy, I can say that it works with any edition.

I couldn’t resist taking it one step further… A few weeks back I saw the tweet from Andreas Nick about a free, built-in tool to convert PowerShell files into EXE’s.

You can find the link to his tweet and YouTube video here. So I used this procedure to convert the first script into an EXE, so it can be run without any PowerShell limitations.

The download includes this EXE, the PowerShell version, the sample CSV and Deployment PowerShell too.

You can always find the most current files by going to http://carlwebster.com/where-to-get-copies-of-the-documentation-scripts/ and looking in the Bart Jacobs’ Toolbox section.

I hope you find this useful and I am really looking forward to your feedback.

Thanks

Bart Jacobs

 

 

 

 

 

 

About Bart Jacobs

Bart Jacobs is a Senior System Engineer/Consultant based in Belgium. He started his career back in 1998. One of the first projects he worked on in those days was Citrix Metaframe 1.8 on Microsoft Windows NT 4 Terminal Server codename "Hydra". Over the years, Citrix technology has always been a major theme in his professional career, resulting in becoming a true technical expert in the matter. In the last few years, he has also become an expert in virtualization technology, with a special interest in a real challenger in this business: Citrix XenServer. Bart has founded his own company BJ IT back in 2007 and is mainly working as a (Citrix) consultant now.

View all posts by Bart Jacobs

One Response to “Deploying Printer Drivers for Citrix XenApp”

  1. Mushtaq Says:

    Wonderful

    Reply

Leave a Reply