Deploying Zebra Label Printers

In most companies, printers are installed on a print server and shared/installed through the domain or through the print server’s print application. The method is more straightforward and allows for the driver installation to occur through the print server and print jobs are more easily managed and monitored.

In some scenarios and for some institutions, this isn’t as practical or useful, so printers are installed with a straight protocol. If network printers, typically that’s TCP/IP (home users often use the WSD so they don’t have to set a static address for the printer on the network, but this can often lead to lag times on printing of loss of the printer at times).

There are several resources out there for installing printers through Powershell or other means, but there aren’t too many showing good results for installing Zebra label printers (including from Zebra themselves), and after just coming across a situation where I needed to deploy some out, I figured now was a good time to get back on the blogging horse and put out some content. So, here we go!

Prepare Printer Sources

Download latest print driver from the vendor. Once extracted, this should have the latest “ZDesigner.inf” and “PrnInst.exe” in the root directory. Let this be your printer sources directory.

Create Install Wrapper

While an optional step, I prefer to create a command line wrapper for the PowerShell script file. While many times the content of what is written can be written in batch or other languages, the purpose of this post is PowerShell, so I like to have the wrapper “install.cmd”.

@echo off
PUSHD %~dp0

Powershell.exe -ExecutionPolicy Bypass -File ".\install.ps1"

Create Powershell Install script

There are two steps to creating the label printer install the way that Zebra intends: installing the port monitor and installing the printer. To install the Zebra printer, it must be installed in that order or the installation will “fail” (during an application/package install, this will hang until the maximum time has been reached as the installation window will pop open, but stay open as the SYSTEM user).

For the port monitor, you’ll need to specify the directory of the port monitor driver, the port monitor, the IP, name of the port, and the port. Since I intend on this running from the ccmcache directory and need to use the absolute path for the .inf, I need to grab the dynamic path.

$directory = (Get-Location).Path

#Installs port monitor first
Start-Process ".\PrnInst.exe" -ArgumentList "/INSTALLPORTMON /inf=$directory\Win64\ `"/monitor=ZDesigner Port Monitor`" /ip=XXX.XXX.XXX.XXX /type=LAN /name=XXX.XXX.XXX.XXX /port=9100" -Wait

Then, we want to install the printer to that port. When that port gets created, it gets set with the “type” and “name” concatenated together (ex: LAN_XXX.XXX.XXX.XXX, from the previous example).

#Installs printer object, in this example, a ZD621-203dpi
Start-Process ".\PrnInst.exe" -ArgumentList "`"/INSTPRN=ZDesigner ZD621-203dpi ZPL#LAN_XXX.XXX.XXX.XXX#ZDesigner ZD621-203dpi ZPL`"" -Wait

Now, put both sets of those code blocks into an “install.ps1” and place in the printer sources directory with the “install.cmd” wrapper. You can now test the install before attempting to package the application in MECM with your appropriate detection method. For a quick detection script on the presence of the printer, you could use the one below:

if (Test-Path "HKLM:\SYSTEM\CurrentControlSet\Control\Print\Printers\PRINTER_NAME") {Write-Host 'Installed'}

The caveat of the method above is that it will not account for changes done to your application if you need to make adjustments. It only checks for the existence of the printer.

Leave a Reply

Your email address will not be published. Required fields are marked *