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:
- Select the right printer model out of the INF file
- 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:
- Launch script “PrintModelSelector”.
- This script will prompt for the INF file to process.
- It will present a list of Printer Models it finds and prompts to select one.
- 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).
- 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.
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.