In this two-part blog series, I’m looking at some of the most commonly asked questions we get about Citrix Optimizer. Want to learn about topics like when and how frequently to optimize your images, how to troubleshoot issues or when will be new templates available? Make sure you check out Part 1.

Which optimization tool should I use?

This isn’t as simple a question as it seems. People often ask about if combination of different Citrix tools is required. “Which optimization tool from Citrix should I use? Do I need TargetOSOptimizer? Should I select Optimize desktop in VDA installer? Run Citrix Optimizer before / after or instead of this tool?”.

“Optimize performance”, using ‘/optimize’ switch for VDA installer or using TargetOSOptimizer (part of PVS) are all using the same tool (TargetOSOptimizer.exe). This component has been removed in CVAD 2009.

This question is much easier to answer now because in Citrix Virtual Apps and Desktops 2009 “TargetOSOptimizer” has been removed from the VDA installer and has been replaced with a suggestion to use Citrix Optimizer instead. Citrix Optimizer is not currently included in the VDA installer (it is just a link that will take you to the CTX article to download it), but we are discussing adding it in the future.

We also need to consider optimization tools from other companies. “How does Citrix Optimizer compare to tool X or tool Y?” I don’t think there is real competition in this field. We’re all just trying to make Windows OS better optimized for virtual desktops. Citrix Optimizer has been focused on stability since the first release, and we base most of our optimizations on recommendations from Microsoft and very carefully review all reports of compatibility or stability issues. There are many commonly known tweaks that are not included in Optimizer, either because they have minimum (or often negative) performance impact, are legacy (no longer required), or there is no public recommendation from Microsoft (the operating system vendor) about recommended configuration.

If you are looking for more aggressive optimizations, I suggest looking at our Template Marketplace and trying some of third-party templates (more on this later). And of course you can always use template builder to create your own templates.

How do I integrate with the automated build process?

Automating your build process has always been one of best practices for both RDS and VDI workloads, and Optimizer has been designed to support this scenario.

When talking about integration, there are usually two topics that need to be covered:

  • How to run Citrix Optimizer from the command line and how to specify which template should be used.
  • How to confirm that Citrix Optimizer has finished successfully.

Citrix Optimizer has continuously evolved over the last few years, and the answer to both these challenges is different than it was few years ago. If you are looking for the easiest possible integration, I can recommend looking at BIS-F. If you want to take care of it on your own, read on.

We have been relying on PowerShell ever since the first prototype, and PowerShell is the native environment for Citrix Optimizer (the user interface is added on top of the underlying PowerShell engine). That makes it easy to automate the integration. Let’s look at how to launch Citrix Optimizer in PowerShell mode. The basic command line is simple:

.\CtxOptimizerEngine.ps1 -Source Citrix_Windows_10_1909.xml -Mode Execute

The -Source (or -Template — both can be used interchangeably) parameter defines the name of the source template to use. You can specify full or relative path. If you specify just the name of template (with or without extension), Optimizer will try to automatically find it under .\Templates subfolder.

This basic execution still works the same way as it did in version 1.0. However, with multiple different Windows builds and templates, you need to start adding more processing logic and things can get very complicated. So a few versions ago we introduced a much better method to automatically select the best suitable template – AutoSelect mode. When you don’t specify the -Source/-Template argument or you use the “AutoSelect” value (instead of the template name), Optimizer will switch to autoselect mode and try to locate the best matching template automatically.

Another advantage of this approach is that we have built support for version fallback. If the current version of Windows is not yet supported (for example Windows 10 build 20H2), Optimizer will automatically find the best available template to use (typically the previous build).

AutoSelect also supports custom templates (as documented under Template Selection). Just by using the proper filename syntax with your own templates, you can automatically include them in the auto selection flow. If the custom template is not available for the current Windows build, Optimizer can fall back to using official Citrix templates.

The second problem with integration is how to validate the script execution. There are few different ways to do this in Citrix Optimizer, depending on your needs.

You can parse the output XML file and look for information about status (under root/run_status). This is a summary of the whole execution and should be easy to read from your PowerShell script (or other language of your choice).

The most important information is the status summary that can be found in the <run_successful /> node (True or False).

However, parsing the XML file is not always the best method, especially if you want to do it on a multiple machines or support centralized processing. That’s why in version 2.7 we have started saving this information in the registry. This information is saved only for execute mode, not for analyze mode. The location of this key is based on the template category (“OS Optimizations” for all current Citrix templates) rather than the template name. Again, this was designed to support a combination of your own custom and official Citrix templates.

You can find more information about this new integration reporting in the release blog post for Citrix Optimizer 2.7.

Can I build my own templates?

I will share a little secret with you. Our official templates are built using the same tools that are available to anyone. We’ve continued to improve the builder experience with every Optimizer release since version 2.0, making it easier to create your own custom template.

When talking about custom templates, there are two different challenges:

  • How to build your own templates.
  • How to distribute and share them with community (if you want to).

First, let me talk a bit about the kind of templates you can build in Citrix Optimizer. You can easily build templates that can disable (or enable) Windows Features, make changes to registry, change the status of scheduled tasks and services, uninstall UWP applications, or run any PowerShell code. It is easy to start with one of our own templates and add your own customizations.

However, templates are not limited to optimizing images only! You can create templates that can analyze your environment (for example to detect and resolve known issues) or templates that have nothing to do with Citrix. For example, I wrote a template to configure my computer after a clean Windows installation, including a Chocolatey script to install all my favorite apps. This gives you a nice and simple UI for your scripts — including advanced features like filtering or HTML reporting.

To build the template, just use a feature called Template Builder from the main Citrix Optimizer menu.

The usage is straightforward. Hover over the info icons to get more help for all the available options. If something is not clear, let us know in comments.

There are some advanced options available here — for example you can use conditional processing (filter entries), create templates that support only read-only (analyze) mode and a lot more. We are going to cover these topics in detail at Citrix Converge 2020. I’ll have more details about that later, but I am very excited about this upcoming session!

Now after you have created your template, you might want to share it with others (and that’s a great idea). Citrix Optimizer supports the concept of template marketplaces. While the official Citrix marketplace is locked down to provide only official templates, you can use our community marketplace to look for third-party templates (or upload your own).

The Citrix Community Marketplace was created by community hero Ryan Butler, and you can find third-party templates from talented folks like David Wilkinson, Dennis Span, John Billekens, Nick Panaccio, and Rob Zylowski. To access the marketplace, follow the instructions from the read me file. (There are a few very simple steps in the user interface.)

See you at Citrix Converge 2020!

Speaking of tips, tricks, and custom templates, did you know that we are going to have a technical session and extended Q&A on Citrix Optimizer at Citrix Converge 2020 event? If you want to support Citrix Optimizer, click here to register and attend this session. I am excited to have the very first technical session dedicated to Citrix Optimizer, and I know it will be interesting.

If you are not familiar with Citrix Converge, it is the event of the year for admins, engineers and developers working with Citrix technologies. It is a free virtual conference (did I mention it is free?) presented by technical experts to help you get the most out of your Citrix technologies. You can read more about it in this blog post and if you have any (Optimizer) topics you would like to see covered, make sure to comment below!


Citrix Tech Bytes – Created by Citrix Experts, made for Citrix Technologists! Learn from passionate Citrix Experts and gain technical insights into the latest Citrix Technologies.

Click here for more Tech Bytes and subscribe.

Want specific Tech Bytes? Let us know! tech-content-feedback@citrix.com.