Master Image Maintenance

Compress WinSxS

Applying the latest Windows Updates is an essential part of monthly master image maintenance. However simply downloading and installing the latest Microsoft Updates is not the end of the process.

After the seal script has been run and the Machine Catalog has been updated, your VDAs will start up with a fresh new image.

Then Tiworker.exe kicks in and monopolises one CPU core on each VDA for up to an hour. If your running Windows 10 VDAs then this may happen several times a day as the default behaviour for a non-persistent VDI desktop is to reboot at logoff. The VDA will then start up and repeat the TiWorker.exe process for an hour.

This is because following a Windows Update, there is a Scheduled Task that cleans up and compresses the WinSxS folder.


The WinSxS folder is located in C:\Windows\WinSxS. It’s the location for Windows Component Store files. The Windows Component Store is used to support the functions needed for the customization and updating of Windows. Manage the Component Store

If you have run the Citrix Optimizer on your Mater Image then this task is probably disabled so you should not have an issue with Tiworker.exe consuming resources.

However the Scheduled Task does serve a purpose.

A Vanilla deployment of WIndows Server 2016 build 14393.0 comes with a 6.5 GB WinSxS folder.

Installing the latest servicing stack and cumulative update (KB4494440 - May 2019) increases the build number to 14393.2969. This increased the size of the WinSxS folder to 10.9 GB. If you have been applying monthly cumulative updates since the creation of the master image, then you'll probably find that your WinSxS folder is significantly larger than 12 GB. If you have to replicate your master image to multiple data centres, or multiple machine catalogs are based on the same master image then you're copying that additional data around every time.

Clean Up the WinSxS Folder

After installing the latest Windows Updates and rebooting your master VDA, open a command prompt and run:

Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase

After running this command the WinSxS folder size reduced to 7.01 GB. Unfortunatley it took 1 hour and 55 minutes for the cleanup process to complete. However there was nearly three years of updates to clean up.

Installing the subsequent cumulative update KB4499177 increases the build number to 14393.2999. The WinSxS folder size increased from 7.01 GB to 7.86 GB. However runnning the same Dism.exe command took only 21 minutes and reduced the WinSxS folder to 7.24 GB.

Therefore to maintain a small WinSxS folder, it worth adding the following to your monthly maintenance or seal scripts.

Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase

Additionally some Windows Scheduled Tasks seem to have a habit of re-enabling themselves, therefore add the following commands to your seal script to ensure that the maintenance tasks are definitely disabled before shutting down and updating your machine catalogs.

schtasks /change /tn "Microsoft\Windows\TaskScheduler\Idle Maintenance" /disable
schtasks /change /tn "Microsoft\Windows\TaskScheduler\Regular Maintenance" /disable
schtasks /change /tn "Microsoft\Windows\TaskScheduler\Manual Maintenance" /disable
schtasks /delete /tn "Microsoft\Windows\TaskScheduler\Maintenance Configurator" /F
schtasks /change /tn "Microsoft\Windows\Servicing\StartComponentCleanup" /disable
REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\Maintenance" /v "MaintenanceDisabled" /t REG_DWORD /d 1 /f