Citirx Universal Print Server – More Zebra label printer troubleshooting tips

/ / /

Continuing on my previous post I was troubleshooting some issues with some Zebra label printers.  I thought I had it working by switching the rendering path to XPS.  This did allow the printers to print – or so I thought.  It turns out that some of the older Zebra printers we had (LP-2824) were not printing the labels correctly, a newer LP-2824 PLUS was printing correctly.  The LP-2824’s were scaling the labels down to 20% for some reason.

In order to capture this so I wasn’t wasting legions of paper, you need to turn on ‘Keep printed documents’ in the ‘Advanced’ tab of your printer.

On your print server (not the client), this option will store the spooler files (SPL) here:

Generally, there are two types of formats encapsulated in a SPL file, RAW and EMF.  Citrix provides a EMF reader in ‘cpviewer.exe’.  This utility is located in Program Files (x86) and is used like this:
“C:\Program Files (x86)\Citrix\ICA Client\cpviewer.exe” C:\00167.SPL

This will bring up a preview.

I setup two scenarios for printing.

Scenario 1 – Printing directly to the print queue with the “ZDesigner LP 2824” driver
Scenario 2 – Printing through the Citrix Universal Print Driver via UPS.

Trying both scenarios caused my cpviewer.exe to hang/freeze.  This is where I learned the cpviewer utility ONLY works with EMF-type SPL files.  Trying to read a RAW file will cause it to hang.  I was able to verify it was RAW by looking at the preferences for the print driver:


It turns out that ‘Printer default’ and ‘Raw’ are the same value.  Selecting ‘Enhanced metafile’ and reprinting to that printer created the proper SPL file that I could open in cpviewer.  With this I could now see the issue the users were reporting:
Left print is direct to the printer, on the right is through Citrix UPD.  I’m missing the barcode on the right.
With the ZDesigner driver, if I forced the ‘Enhanced metafile’ in the preferences, all the Citrix UPD prints lost their barcodes.  If I set the Citrix UPD to XPS and the Zebra on RAW it printed with a barcode, but the scale was still horribly off (same as the picture above).
I tried adjusting almost every option available on the ZDesigner side, from the paper size, dpi, different stocks, etc.  It consistently turned out scaled down.  If I adjusted the margins it would move the graphic around but nothing would enable the graphic to be the correct size.  I looked at the Citrix UPD advanced settings and changed the paper height, width, dpi, scale, print quality, orientation, etc. Not a single affect was made except for orientation.  At least I knew the settings were applying because of that.  Orientation didn’t make a difference in the scale, just made the tiny graphic vertical instead of horizontal.  At this point I decided it had to be driver related.  I downloaded two different sets of ZDesigner Zebra drivers for the LP-2824, the latest and the last major version release, installed both but the exact same issue still persisted.
Searching for others that may have had the same issue or something similar I found a link to another company providing Zebra label printer drivers, Seagull Scientific.
With nothing else to lose, I installed and configured those drivers per the original spec for media, etc.  Then I printed and checked the SPL file:
Success!  Barcode is present!  Scale is correct!  Format is pure EMF from Citrix UPD to barcode printer, no XPS anywhere, no RAW anywhere!
All that said, this is a ringing endorsement for what Seagull Scientific has done with the Zebra Barcode printers.  Their drivers *just work* as opposed to the ZDesigner drivers.  If you need to print to older Zebra printers, heck, probably for all Zebra printers, use Seagull’s drivers.
Read More

Citrix Universal Print Server – Troubleshooting printing blank pages or inconsistent printing.

/ / /

We have an application that is hard coded to map printers via a UNC path.  This is the bane of a Citrix admin whom wants to minimize the number of drivers on the XenApp server as each UNC connection can prompt for a driver install (this is how our environment is configured).  User’s click ‘Install Driver’ and boom, your Citrix server has another driver on your server and another point of possible instability.

Citrix has attempted to solve this using the Universal Print Driver (UPD) but this just maps printers from your local system to the Citrix session.  Each printer is given a unique name and each queue is given a unique port as well.

Unfortunately, this makes it impossible for our hardcoded app to use a consistent printer as these queues and names do not exist unless we install them locally.  If the program displayed a simple print dialog this wouldn’t be an issue but it is not coded that way.

Fortunately, Citrix has come up with a *fairly* elegant solution: Citrix Universal Print Server (UPS).  How this works is it forces the mapped network printers to come across using the Citrix Universal Print Driver.  There are two parts to this, the Citrix UPS and the Universal Print Client (UPC).  The UPS goes on your Windows Print Server and the UPC goes on your XenApp servers.

XenApp server

Windows Print Server

To enable the UPS functionality and have your network printers use the Citrix UPD you need to enable a Citrix group policy object on the XenApp server (that’s why you see Citrix Group Policy Management (x64)  If you have a version older than then you won’t have the relevant policy available to you:

Setting this setting to either “Enabled” setting turns on the UPC feature.  For any network printer that you map to the Windows Print Server with the UPS it will use the Citrix UPD.  To verify this, go to your XenApp server and map a printer from the UPS and look at the driver.

UPS in Action.  Note the driver for the network printer is “Citrix Universal Printer”

Ok, so with UPS installed and working we should be good right?

Right?  🙂

Well…  It turns out that our label printers were printing out blanks with Citrix UPS.  To determine if it was truly the UPS causing my problem I enabled printer mapping, added the network printer locally complete with the native driver and launched my app.  This mapped my local printer into my session with the Citrix UPD.  I tried printing and…   nothing.  Just a blank label came out.

To troubleshoot this process, Zebra actually has a good document on determining if your printer is rendering/printing correctly by printing to a text file.  If you have a new enough Zebra printer installed you can actually use it to ‘preview’ the label so you don’t waste paper, AND you don’t need have a label printer physically present beside you.  Older Zebra’s don’t seem to have this functionality (LP 2824 I’m looking at you!).  I had a PDF file I tried printing from PDF Architect that output to the text file.

So, what did my print job look like?


What does this look like on the Zebra?

Well then. Curiously, if I printed the same document from Adobe Reader it came out like this:


Label looks good
So, when we print from Adobe Reader we get the expected result.  But if we print from PDF Architect or directly from our application we don’t get anything and the data is missing entirely!  This is a strange issue indeed.  The Zebra driver shows its supported formats:
RAW or EMF…  The Citrix UPD has two modes, EMF (standard “Citrix Universal Print Driver”) or XPS (“Citrix XPS Universal Print Driver”).  I would assume EMF to EMF would be the way to go?
By utilizing the ‘printer mapped’ UPD, avoiding the UPS, we can enable ‘Print Preview’ functionality and look at the EMF file as it’s placed in the print queue.  Here’s is what I see:
Adobe Reader on the left, PDF Architect on the right
Well, there is content being sent to the print queue from both applications.  Adobe Reader looked slightly heavier in its lines vs. PDF Architect but both SPL files had content.  This is still very confusing why Adobe Reader actually prints but PDF Architect does not.  Maybe it’s in the way Adobe Reader processes its file?  I don’t know.  Maybe there’s a way to modify EMF on Citrix?  It turns out, you can.
Citrix offers the ability to modify the way it’s EMF driver works by reprocessing it.  You can enable this feature via Group Policy.  
Reprocess EMF for printer
Did it make a difference?  No.  Still a blank page/no content for PDF Architect, Adobe Reader prints out fine.  
At this point I was at my ropes end and decided to grasp at straws.  
The Citrix UPS also allows you use the XPS driver instead of the EMF driver.  This would force a completely different rendering path, XPS -> XPS to GDI -> EMF -> GDI/DDI Driver -> PDL Print Device.  We know it has to go this way as the Zebra driver only does EMF or RAW and the UPD will only output EMF files.  To enable XPS printing I changed the Universal Driver Preference to favour XPS.

 I reprinted to XPS from both PDF Architect and Adobe Reader.  Again, Adobe Reader showed up darker but again there is content to be printed from both spools.

PDF Architect on the left, Adobe Reader on the right
And what did the print queue show?
PDF Architect:


Adobe Reader:


Success!  It appears changing the rendering path to XPS works in resolving the data not getting rendered.  When printed from the application with the EMF driver and a blank page was spit out, I tried again with the XPS driver and it worked successfully:


To that end, I am concluding my work.  Unfortunately, I do not know why Adobe Reader always worked without issue where two other applications did not.  When on EMF mode, I could send a test page to the printer via print properties and it would have the full content, I could also print from notepad to the EMF queue and it worked just fine.  For some reason, whatever path PDF Architect and my other application uses to print to the EMF driver just didn’t work.  The Citrix EMF Viewer would display content, implying there is data.  I do know there are several versions of EMF (NT EMF 1.003-8) you can choose on the printer processor properties, but it appears the Zebra driver ignores those settings in favour of it’s selection I posted previously.  Forcing a different print processor (HP or Lexmark) in addition to an incompatible print processor type (TEXT/XPS) the Zebra driver will still work.  So maybe it’s a EMF version compatibility thing and whatever version Adobe Reader is passing works?  
Read More

AppV5 – Prelaunch Script for Citrix XenApp 6.5 applications with varying environments

/ / /

We utilize a lot of pre-launch scripts for our AppV5 applications that we use in our Citrix XenApp 6.5 environment.  They become a necessity very quickly as AppV5 stores the executable down a very long path.  Citrix XenApp 6.5 has a maximum launch string of 160 characters and this maximum prevents a lot of applications from working if they require parameters to be passed to them.  An example looks like this:

This launch path is too long for XenApp 6.5.  The string will be truncated and the program will fail to launch properly.   We have several environments that work with the same package files so we set them as variables.  To get this package to launch properly we create a prelaunch script that looks like so:
At this point we set our application to point to this CMD file.
And the application will launch with the shorter string with the ability for us to change the environment and location quickly and easily.
Read More

AppV5 – Recipe for Epic 2012

/ / /

AppV5 – Sequencing first steps


I create install.cmd files for all of my applications so that, if required in the future, I can re-sequence an application quickly completely through script or via one of those ‘PowerShell AppV5 automated GUI’s’.


Supplemental files:
1) Select ‘install.cmd’ and click ‘Next’
2) Name the package and click ‘Next’
3) Let the install script do its thing (note the clock)…

4) AppV5 – Post install sequencing steps

5) Review for any extra registry keys/files (generally there are none or very few) and remove and save the package.

6) In order for Epic to launch in a reasonable amount of time, registry staging must be done.  Without a pre-executed registry staging, first launch performance of Epic can take hundreds of seconds.

Read More

AppV5 – Recipe for ScreenTest III

/ / /

This is the most recent app I sequenced and a good template for how I am going to do my recipes.

AppV5 – Sequencing first steps


I create install.cmd files for all of my applications so that, if required in the future, I can re-sequence an application quickly completely through script or via one of those ‘PowerShell AppV5 automated GUI’s’.


Supplemental files:
1) Select ‘install.cmd’ and click ‘Next’
2) Name the package and click ‘Next’
3) Let the install script do its thing…

4) AppV5 – Post install sequencing steps

5) Review for any extra registry keys/files (generally there are none or very few) and remove and save the package.

Read More

AppV5 – Post install sequencing steps

/ / /

1) Check ‘I am finished installing’ and click ‘Next’

2) Wait out the ‘Collecting system changes’…

3) You may choose to ‘select’ your application and click ‘Run Selected‘ then click ‘Next’

4) Click ‘Next’

5) Select ‘Customize’ and click ‘Next’

6) Select ‘Force applications to be fully downloaded’ and click ‘Next’

7) Select ‘Allow this package to run on any operating system’ and click ‘Next’

8) Select ‘Continue to modify this package without saving using the package editor’ and click ‘Next’

9) Click ‘Close’

Read More

AppV5 – Sequencing first steps

/ / /

I follow a specific pattern when sequencing my applications.  I’m going to put the same first steps for every application I sequence here.

1) Open the ‘Microsoft Application Virtualization Sequencer’ and select the menu ‘File’ then ‘Load Template…’

2) Browse to and select your template.

3) Click OK

4) Click ‘Create a New Virtual Application Package’

5) Click ‘Next’

6) Click ‘Next’

7) Choose ‘Standard Application’ and click ‘Next’

Read More

Setting up a PVS AppV5 sequencer

/ / /

A typical workflow for sequencing an application is something like this:
1) Take a snapshot of your sequencer (odds are it’s a virtual machine [VM])
2) Power up your sequencer and sequence your application
3) Move your application to your system, test it, try and catalog all problems.  Revert your VM snapshot and go to step 1.

In several environments that I have worked in, this is a bit of a hassle as most environments implement the ‘Machine Account Password Expires after X days’.  So after that time you either need to delete your snapshot, power on your VM and rejoin domain then start over.  This gets really cumbersome with multiple sequencers to take care of.  In addition, at my current environment, we require Windows Update be up-to-date and applied to all machines, including sequencers.  Reverting a snapshot to before Windows Update will, sometimes, cause Windows Update to start upon the desktop when you login.  There is a lot of overhead and hassle to maintaining snapshots, though it is better than the alternative of reinstalling the operating system each time you want a clean sequencer.

There is a very elegant solution to all of this I have found that also allows me to sequence super fast.

Citrix Provisioning Service (PVS).

Citrix PVS works by managing the Active Directory machine account password for me, so I never have to reset it again.

With Citrix PVS you can create several sequencers from one vDisk.  This ensures consistency and avoids tech’s having their own VM with their own nuances.

Citrix PVS allows you to create a version of the vDisk and apply Windows Update’s.  Automatically, all of your sequencers get the updates applied.

With ‘Standard Image’ mode, the VM now becomes ‘non-persistent’.  This means if you reboot your VM it will go back to the state it was when it was last powered on.  PVS requires a ‘persistent’ supplemental disk attached to the VM for things like the event log, page file and the write cache files.  We ensure the supplemental disk is large enough so we can locally store application installer files there (temporarily!) then the installer files go onto a fileshare that has regular backups, etc.

Starting with Citrix PVS 7.1 there is a new feature called ‘Cache to device RAM with overflow on hard disk’.  By utilizing a memory sizing for your sequencer VM that can run the operating system *and* contain the largest application in total megabyte size, your sequencing can go super duper fast!  Sequencing to the operating system drive with this PVS feature will actually write to RAM, which is significantly faster than disk.  This shortens sequencing times significantly.  You will need to ensure your cache size is large enough for your largest application or else the overflow to disk will slow you down.

But won’t this setup fail to work with AppV5’s ‘reboot’ feature?

Starting with AppV5 you can now *reboot* an application in the middle of sequencing and the sequencer is supposed to be pickup after the reboot and continue to capture.  So far, I have not had good luck continuing sequencing after rebooting with the AppV5 sequencer.  I’ve found, with a 100% success rate *so far* that a reboot is not necessary.  I’m aware that applications like Chrome show that a reboot can make a package work successfully, but I prefer to figure out what it does post-reboot and just implement that in the sequence instead.

By avoiding doing reboots we are not missing that feature at all.  In cases where it is absolutely required
I have a workaround.  I create another vDisk version in Maintenance mode

And set my Sequencer VM to Maintenance mode.

This turns the VM to a ‘persistent’ state for this duration.  Once the sequence is completed I delete the version and set my VM back to production.  The caveat here is only one VM may use the maintenance version at a time.

What should I put on my PVS Sequencer?

As per my previous topic, I believe you should try and minimize the visual C++ runtimes that are different from your sequencer to your VDI/XenApp server boxes.  If possible, make them identical.  This prevents AppV5 from usurping installed versions of this runtimes when pushed to your VDI/XenApp servers.  They may still get usurped if an application has a different version installed then what you have on your box, but I strongly believe in minimizing it if possible.  There may also be a (small) benefit by speeding up your application first launch experience by removing some minor registry staging.

Here is what I have on my sequencer and a clipping of some of the software we run on our XenApp servers:

All of the software on the Sequencer

A small clipping of software on the XenApp servers

With the PVS sequencer you have a static, persistent disk that you can use to locally store installer files, notes, AppV template file, whatever you need to help you get sequencing.

A little snapshot of my persistent disk

How do I sequence with this thing?

For my sequences, I usually create a batch file that lets me do a silent install of the application and any shortcut configuration.  I can then use this batch file to do a completely scripted sequence if required in the future.  Otherwise, sequencing is identical to how you would do it previously, but you cannot restart the system!  Restarting will result in a clean sequencer coming back up (after all, that’s the point!)
Read More

AppV5 – Be mindful of application integrations

/ / /

When you sequence an application in AppV5 there are special keys that will be ‘integrated natively’ into your system.  These keys are HKLMSoftwareClasses.  There are numerous things that can be integrated and these include things like File Associations or, even worse, libraries.  I believe a ‘best practice’ should be to make your sequencer and target platform as close as possible by installing the same software on both if you can.  For example, for all the Visual C++ native runtime libraries on your target device have that same software on your sequencer too.  If they differ than the natively installed package will be usurped by a AppV5 package’s deployment.

AppV5 Package has usurped a natively installed control

The differences in the two files
This can cause issues if you are not careful about the deployments of your AppV packages as well as Windows will now natively use some libraries that may have security concerns.  This can also cause some issues if poorly written applications have specific version requirements and if multiple packages are installed with overlapping files/keys, it appears the last loaded package wins.
In one particular example I made an ‘Internet Explorer’ package that changed the registry keys within IE so it would identify itself as IE 6.  Doing this resulted in the http key being changed as well:
This resulted in every programatic launch of a URL to launch iexplore.exe within a different AppV bubble.  This was unexpected as I do Internet Explorer customizations within my packages so that when you launch IE you have the IE customizations for that app all with you.  This one package caused issues as http launches to went into this package as opposed to the package you were in when you launched it.
So, if you have a machine that loads multiple packages, be aware of these potential issues.
Read More

Crystal Reports 13 and AppV 5 have issues

/ / /
Crystal Reports 13 and AppV 5 have issues.  Crystal Reports 13 (CR) installs to some long paths which fail when loaded AppV5 tries to ‘integrate’ them.  A blog detailed shortening the installdir path to something much shorter but CR still failed for me.  My path without modifying the INSTALLDIR property was:
C:\ProgramData\Microsoft\AppV\Client\Integration\14FA6B99-E7E2-4F5A-B7FC-4B024DE1705A\Root\VFS\ProgramFilesX86\SAP BusinessObects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win64_x64
224 Characters.
With the modified INSTALLDIR it was:
C:\ProgramData\Microsoft\AppV\Client\Integration\14FA6B99-E7E2-4F5A-B7FC-4B024DE1705A\Root\VFS\ProgramFilesX86\1\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win64_x64
206 Characters.
This still failed.
The symptoms were errors in the application:


‘The type initializer for ‘CrystalDecisions.CrystalReports.Engine.CRPE’ threw an exception.
Attempting to register the DLL’s related to these resulted in these errors:


[Window Title]
The module “clientdoc.dll” may not compatible with the version of Windows that you’re running. Check if the module is compatible with an x86 (32-bit) or x64 (64-bit) version of regsvr32.exe.
Since AppV5 integrates HKCR keys natively into the system, if you can’t register a DLL via a long path, then you will error with CR.


You can actually replicate a similar error by trying to ‘install’ CR with a long path, so it’s not AppV5 that’s at fault, but apparently something within the CR DLL’s.  Trying to install to a path similar in length to the AppV5 path will fail:


So what is the maximum length CR can be installed to?


259 total characters.  At 260 characters or greater the installer fails with an error similar to the above. I’m not sure why the AppV5 path is significantly less, but it is for some reason.
In the end my path was:
158 Characters.
To do this I needed to modify the SAP Crystal Reports 13 file with a MST transform file.  I did it by doing this:
1   1.
Copy the ScreenTest III installation source files to a temporary folder C:swinst on the sequencing machine (WSAPVSEQ07 – Windows 2008 R2 SP1 in this case).
1   2.
Install Orca.msi
1   3.
Launch Orca and ‘Open’  the Crystal Reports version
1   4.
Choose Transform from the menu > ‘New Transform’
1   5.
Select ‘Directory’ and find the first instance of ‘CrystalR|Crystal Reports for .NET Framework 4.0’
1   6.
Double-click ‘CrystalR|Crystal Reports for .NET Framework 4.0’ and copy the field.  Select the menu ‘Edit’ > ‘Replace’ and set ‘Find what’ as ‘CrystalR|Crystal Reports for .NET Framework 4.0’ and ‘Replace with:’ as ‘CrystalR|C’
And click on ‘Replace All’.  If you get prompted:
Select ‘Yes’.
1   7.
Repeat the process for ‘SAPBusin|SAP BusinessObjects Enterprise XI 4.0’  to ‘SAPBusin|X’
1   8.
Select ‘Registry’ and sort by ‘Value’.  Find the first instance of [INSTALLDIR]
1   9.
Do a ‘Replace’ and enter ‘[INSTALLDIR]Crystal Reports for .NET Framework 4.0CommonSAP BusinessObjects Enterprise XI 4.0’ for ‘Find what’ and ‘Replace with’ as ‘[INSTALLDIR]CCommonX’

And click on ‘Replace All’

1   10.
1   11.
Select the menu ‘Transform’ > ‘Generate Transform’ and save the file as something like:
1   12.
Select the menu ‘Transform’ > ‘Close Transform’ and exit out of Orca.
You can now install SAP CR with a command line similar to this:

Read More