What’s New in Windows Servicing: Part 1

My name is Aditya and I am a Senior Support Escalation Engineer for Microsoft on the Windows Core Team. I am writing today to shed some light on a the new changes that have been made to the Windows Servicing Stack in Windows 8.1 and Windows Server 2012 R2. This is a 4 part series:

What’s New in Windows Servicing: Part 1
What’s New in Windows Servicing: Reduction of Windows Footprint : Part 2
What’s New in Windows Servicing: Service Stack Improvements: Part 3

Windows 8.1 brings in a lot of new features to improve stability, reduce space usage and keep your machine up to date. This blog series will talk about each of these new features in detail and talk about some of the troubleshooting steps you will follow when you run into a servicing issue.

What is Servicing and The Servicing Stack: Windows Vista onwards use a mechanism called Servicing to manage operating system components, rather than the INF-based installation methods used by previous Windows versions. With Windows Vista and Windows Server 2008, component-based builds use images to deploy component stores to the target machine rather than individual files. This design allows installation of additional features and fixes without prompting for media, enables building different operating system versions quickly and easily, and streamlines all operating system servicing.

Within the servicing model, the update process for Vista+ Operating systems represents a significant advance over the update.exe model used in previous operating systems. Although update.exe had many positive features, it also had numerous issues, the foremost of which was the requirement to ship update.exe engine with each package.

Servicing is simplified by including the update engine, in the form of the servicing stack, as part of the operating system. The servicing stack files are located in the C:\Windows\WINSxs folder.

image

This folder can grow very large on Windows 2008 and Windows 2008 R2 system and more information can be found at why this happens at :

What is the WINSXS directory in Windows 2008 and Windows Vista and why is it so large?
https://blogs.technet.com/b/askcore/archive/2008/09/17/what-is-the-winsxs-directory-in-windows-2008-and-windows-vista-and-why-is-it-so-large.aspx

What’s new in Windows 8.1 and Server 2012 R2:

1. Component Store Analysis Tool:

A new feature has been added to the DISM command that will allow users to get detailed information on the contents of the Component Store (WinSxS folder).

There have been many users, mainly power users and IT Admins of Windows, who have raised concerns around the size of the WinSxS store and why it occupies so much space on the system. These users also have complaints about the size of WinSxS growing in size over time and are curious to know how its size can be reduced. A lot of users have questioned what happens if the WinSxS store is deleted completely. There have been multiple attempts in the past to explain what the WinSxS store contains and what the actual size of the WinSxS store is. For this OS release, a reporting tool has been created that a power user can run to find out the actual size of the WinSxS store as well as get more information about the contents of the Store. This is in addition to the article we will be publishing for users to understand how the WinSxS is structured, and what the actual size is as compared to the perceived size of this store.

The purpose of this feature is two-fold. First, is to educate power users and IT Admins of Windows about what WinSxS is, what it contains and its importance to the overall functioning of the OS. Second, this feature will deliver a tool via the DISM functionality to analyze and report a specific set of information about the WinSxS store for power users.

From various forums and blog posts, there seem to be two main questions that users have:

· Why is WinSxS so massive?

· Is it possible to delete WinSxS in part or completely?

In addition to this, OEMs do have questions about how they can clean up unwanted package store, servicing logs, etc. from the image.

Based on these questions, we felt that the most important metric for our tool would be the actual size of WinSxS. Secondly, it would be good to report packages that are reclaimable so that a user can startcomponentcleanup to scavenge them. Lastly, for devices like the Microsoft Surface, which remain on connected standby, it may be possible that the system never scavenged the image. In that case, considering that these tablets have small disk sizes, it becomes important to let users know when it was last scavenged and whether scavenging is recommended for their device.

We expect the amount of time for completion of the analysis to be somewhere between 40 and 90 seconds on a live system. In this scenario, there needs to be some indication of progress made visible to the user. We will use the existing progress UI of DISM to indicate the % of analysis completed to the user. The user will also get the option to cancel out of the operation through the progress UI.

The following steps describe the end to end flow of using the component store analysis tool:

· The user launches an elevated command prompt by typing Command Prompt on the Start screen.

· The user types in the DISM command:

Dism.exe /Online /Cleanup-image /AnalyzeComponentStore

At the end of the scan, the user gets a report of the results like this:

image

2. Component Store Cleanup:

The Component Store Cleanup functionality is one of several features aimed at reducing the overall footprint and footprint growth of the servicing stack. Reducing the footprint of Windows is important for many reasons, including providing end users more available disk capacity for their own files, and improving performance for deployment scenarios.

Component Store Cleanup in Windows 8 was integrated into the Disk Cleanup Wizard. It performs a number of tasks, including removing update packages that contain only superseded components, and compressing un-projected files (such as optional components, servicing stack components, etc.). For Windows 8.1, we will add the capability to perform deep clean operations without requiring a reboot.

Today, Component Store Cleanup must be triggered manually by an end-user, either by running DISM, or by using the Disk Cleanup Wizard. In order to make Component Store Cleanup more useful for the average end-user, it will be added into a maintenance task, automatically saving disk space for end-users. To enable this, a change will be made to allow uninstallation of superseded inbox drivers without requiring a reboot (today, all driver installs/uninstalls done by CBS require a reboot).

The superseded package removal feature of deep clean attempts to maintain foot print parity between a computer that has been serviced regularly over time vs. a computer that has been clean installed and updated.

2.1. How can Component Store Cleanup be initiated?

Component Store Cleanup will support being initiated in the below 3 ways:

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

clip_image002

2. Disk cleanup wizard :

a. To open Disk Cleanup from the desktop, swipe in from the right edge of the screen, tap Settings (or if you're using a mouse, point to the lower-right corner of the screen, move the mouse pointer up, and then click Settings), tap or click Control Panel, type Admin in the Search box, tap or click Administrative Tools, and then double-tap or double-click Disk Cleanup.

b. In the Drives list, choose the drive you want to clean, and then tap or click OK.

c. In the Disk Cleanup dialog, select the checkboxes for the file types that you want to delete, tap or click OK, and then tap or click Delete files.

d. To delete system files:

i. In the Drives list, tap or click the drive that you want to clean up, and then tap or click OK.

ii. In the Disk Cleanup dialog box, tap or click Clean up system files. clip_image003 You might be asked for an admin password or to confirm your choice.

clip_image005

c. In the Drives list, choose the drive you want to clean, and then tap or click OK.

d. In the Disk Cleanup dialog box, select the checkboxes for the file types you want to delete, tap or click OK, and then tap or click Delete files.

clip_image006

e. Automatic from a scheduled task:

i. If Task Scheduler is not open, start the Task Scheduler. For more information, see Start Task Scheduler.

ii. Expand the console tree and navigate to Task Scheduler Library\Microsoft\Windows\Servicing\StartComponentCleanup.

iii. Under Selected Item, click Run

clip_image008

The StartComponentCleanup task can also be started from the command line:

schtasks.exe /Run /TN "\Microsoft\Windows\Servicing\StartComponentCleanup"

For all three methods, an automatic scavenge will be performed after the disk cleanup in order to immediately reduce the disk footprint. When scavenge is performed for option 1, NTFS compression will not be used since it has a negative impact on capture and apply times, but Delta Compression will be used since it will help with both capture and apply. When run automatically for option 3, deep clean and the scavenge operation will be interruptible in order to maintain system responsiveness.

2.2. What does Component Store Cleanup do?

During automatic Component Store Cleanup, packages will be removed if the following criteria apply:

§ All components in package are in superseded state

§ Packages are not of an excluded class (permanent, LP, SP, foundation)

§ Package is older than defined age threshold

· Only packages that have been superseded for a specified number of days (default of 30 days) will be removed by the automated deep clean task. In order maintain user responsiveness automatic Component Store Cleanup will perform package uninstall operations one at a time, checking to see if a stop has been requested in between each package.

· The Component Store Cleanup maintenance task will be incorporated into the component platform scavenging maintenance task. This task runs every 1 week, with a deadline of 2 weeks. This ensures that scavenging and deep clean processing happens relatively quickly after patches are released on patch Tuesday.

Manual Component Store Cleanup

During manual Component Store Cleanup, packages will be removed if the following criteria apply:

· All components in package are in superseded state

· Packages are not of an excluded class (permanent, LP, SP, foundation)

The functionality for manual Component Store Cleanup largely already exists in Win8. To improve performance, manual deep clean will perform all package uninstall operations in a single KTM transaction, and is not interruptible. Superseded packages are not subject to an age limit. Instead they are removed immediately.

The next blog in the series we will discuss more about Delta Compression & Single Instancing…

Aditya
Senior Support Escalation Engineer
Microsoft Platforms Support