Home > MS Windows, OS > Windows Server 2012R2: clean up WinSxS using DISM.

Windows Server 2012R2: clean up WinSxS using DISM.

Over time, as your Windows Server runs longer and longer, more and more disk space (on system partiotion) is eaten. Simply gone. Investigating the disk usage leaves you clueless: there are no large log files, crash dumps, or there is no software to be removed. Where did that space go?
The answer as always is simple: Windows Updates, Service Pack, and hotfix installations.
On Windows Server, the Windows component store (C:\Windows\WinSxS) contains all the files that are required for a Windows installation. And, any updates to those files are also held within the component store as the updates are installed (source: KB2795190 and do read Manage the Component Store). The WinSxS folder will become larger and larger…
Deployment Image Servicing and Management (DISM) is a command-line tool that allows you to install, uninstall, configure, and update Windows features, packages, drivers, and international settings. The /Cleanup-Image parameter of dism.exe provides advanced users more options to further reduce the size of the WinSxS folder.
Here are the parameters most useful for clean up WinSxS folder:
1. Use the /AnalyzeComponentStore to analyze the size of the Component Store (WinSxS folder) in Windows. The AnalyzeComponentStore option is available in Windows 8.1 and Windows Server 2012R2.

dism.exe /Online /Cleanup-Image /AnalyzeComponentStore

2. Dism.exe removes superseded and unused system files from a system with the /StartComponentCleanup parameter (parameter is supported on Windows 8 and Windows Server 2012).

dism.exe /Online /Cleanup-Image /StartComponentCleanup

3. Using the /ResetBase switch with the /StartComponentCleanup parameter of dism.exe, all superseded versions of every component in the component store is removed (parameter is supported on Windows 8.1 and Windows Server 2012R2).

dism.exe /Online /Cleanup-Image /StartComponentCleanup /ResetBase

All existing service packs and updates cannot be uninstalled after this command is completed. This will not block the uninstallation of future service packs or updates.
4.The /SPSuperseded parameter removes any backup components needed for de-installation of a service pack (parameter is supported on Windows 7, Windows Server 2008R2 SP 1, Windows Server 2012, Windows Server 2012R2). The service pack cannot be uninstalled after this command is completed.

dism.exe /Online /Cleanup-Image /SPSuperseded

After cleaning up the disk, a server reboot is required – the actual cleanup of the WinSxS directory occurs during the next reboot.

Categories: MS Windows, OS Tags: , , ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a comment