Time travel is a topic that has always fascinated me. I am an experienced time traveler myself; I am a master of making time move forward (often far faster than I’d like it to)… I just haven’t figured out how to go backward just yet. But that’s why we decided to include support for time travel in Citrix Optimizer (a.k.a. ability to roll back changes), going back to its first-ever release.

How rollback works

Using rollback in Citrix Optimizer is simple; all you need to do is activate the flux capacitator by reaching 88 miles per hour to generate 1.21 jigowatts… wait, sorry, wrong timeline. Using rollback in Optimizer is simple, but you need to use PowerShell mode.

Any time you run Citrix Optimizer, there are few files that are automatically generated. Some of these can be used for troubleshooting (CitrixOptimizer.log for UI or Log_Debug_CTXOE.log for command line mode), others report output in human readable format (HTML report) or machine readable format (XML report).

This approach provides us with best of both worlds: we generate an HTML report that is easy to read, but that also produces an output XML file that can be further processed if needed. XML output file also contains more detailed information about the changes Optimizer makes to your operating system. If you later decide to roll back these changes, Optimizer can process this XML file and revert all modifications. This means that rollback in Optimizer is not just a simple switch that will apply hardcoded configuration.

When you decide to roll back changes, Citrix Optimizer will read an XML file that was generated when you optimized your environment. In this file, Optimizer will find details about the configuration of your environment before this execution and return the environment to its original state. This is true rollback; if you have already implemented some changes (for example disable some services in your master image), Citrix Optimizer will honor this configuration and not force unexpected settings on your system. Output XML files are always located under .\Logs folder and are usually called Execute_History.xml.

TIP: During execution, you can also specify additional location and file name using argument -OutputXml. This will create a duplicate of Execute_History.xml in location that you specify, so it might be easier to locate it.

To roll back changes, you need to provide the Optimizer engine with two arguments:

Mode — This will always have value of “Rollback”

Source — This will be an XML output file from one of the previous executions, usually called Execute_History.xml and located under .\Logs folder

Here’s an example of a rollback operation:

If you are not sure which file to use, just browse through .\Logs folders. Notice that folder names reflect the date and time that the operation was performed (<year>-<month>-<day>_<hour>-<minute>-<seconds> format for easy sorting):

And again, you are looking for file Execute_History.xml, so nothing prevents you from searching for that file:

TARDIS module under microscope

Now, I want to talk a bit about technical implementation and how rollback is reflected in the XML files. If you are not interested in these details, feel free to stop reading.

To better understand rollback mode, let me first explain how templates are used in Citrix Optimizer. In the user interface, you can see templates located in .\Templates folder. When you select a template and make changes in UI (e.g. select or unselect some of the optimizations), this template is copied to .\Logs folder and prefixed with “~” character with all your changes (as we don’t want to overwrite the original template). When the UI launches the PowerShell engine, this template file is passed to it using -Source argument. The engine will process it, add some notes about execution (e.g. timestamps, if execution was successful, etc.)and save this in a file called <Mode>_History.xml. This is fed back to the UI to show you results (whether or not each of the entries has been executed successfully).

For each of your optimizations that is being executed, the engine will add a new section called <history /> under <entry /> node. This includes details about timing (start time and end time), whether or not execution was successful (<result />) and details of execution (<details />). History node also contains information about whether there were any changes made to the system or not (<systemchanged />).

When Optimizer is making changes to the operating system, it will not only report that it has changed something, but it will actually save information about exactly what has been changed. This is saved in a section called <rollbackparams /> and includes information about the previous configuration of the system. This is information about the state of your machine beforeOptimizer made any changes to it.

< name > FamilySafetyRefresh Synchronizes the latest settings with the Microsoft family features service. < execute > caction> < params> < na m FamilySafetyRefreshTask < / na me > \ Microsoft \ Windows \ Shell < /path> Disabled FamilySafetyRefreshTask< name < \ M icrosoft\Windows \Shell cstarttimé>8/27/2018 cendtime>8/27/2018 creturn> < result>l Task has been Disabled</detai’ </entry > Information required for rollback Genera information about execution ” v:shapes=”Picture_x0020_1″>

What this allows us to do is return your system to configuration in place before Citrix Optimizer made any changes. Had you already disabled some services? Had you used a custom master image? Had Microsoft changed default configuration in latest builds? This rollback mechanism is more dynamic than simply changing settings from enabled to disabled and vice versa.

Do you like this feature? Are there any features in Citrix Optimizer that you are missing (or just want to tell us know how awesome it is)? Make sure to leave some comments or tweet about your experience (@MartinZugec)!

And, of course, here are a couple of links to help you get started:

Citrix TechBytes – 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 TechBytes and subscribe.

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