News, tips, advice, support for Windows, Office, PCs & more. Tech help. No bull. We're community supported by donations from our Plus Members, and proud of it
Home icon Home icon Home icon Email icon RSS icon
  • WinSXS cleanup manually instead of cleanmgr?

    Home Forums AskWoody support Windows Windows 7 Windows 7 patches WinSXS cleanup manually instead of cleanmgr?

    This topic contains 5 replies, has 4 voices, and was last updated by  mn– 1 month ago.

    • Author
      Posts
    • #2002553 Reply

      mn–
      AskWoody Lounger

      Yeah, right, cleanmgr is the tool of choice for cleaning up the component store (winsxs) …

      Well I have one case where cleanmgr just errors out (after ~5 hours) and doesn’t do much anything. Going from the CBS logs, there’s a few individual updates that have missing metadata, possibly because the system ran out of disk space at some critical point some time ago. Others do have the appropriate metadata.

      (It’s a server with a fair amount of activity, including several applications that automatically manage their own disk space usage… independently of each other except for total usage on C: and no, I didn’t set it up.)

      Anyone know of a way to do winsxs cleanup by individual component with, say, PowerShell, so that it could work in this situation?

      It’s a Server 2008 R2 SP1 so I expect this part to work like 7 …

    • #2002644 Reply

      joep517
      AskWoody MVP

      Have you tried

      DISM /online /Cleanup-Image /SpSuperseded and
      Dism.exe /online /Cleanup-Image /StartComponentCleanup

      Also, see Repair corrupt Windows image error

      --Joe

      • #2002803 Reply

        mn–
        AskWoody Lounger

        DISM /online /Cleanup-Image /SpSuperseded

        Yeah, that didn’t do much… after several runs and reboots have managed to shave about as much off the entire winsxs dir as the CBS.log file grew by while doing that. Still a few dozen GB too large to my tastes.

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

        That’s only from W8 / Server 2012 onwards I believe…?

        Anyhow, all it says is “Error 87 The startcomponentcleanup option is not recognized in this context…”

        /ScanHealth has been run, didn’t report problems. SoftwareDistribution was cleaned up already too.

    • #2002814 Reply

      Microfix
      Da Boss

      There is a portable utility that I’ve been using on W7/8.1 and occasionally on W10 that has never failed, introduced to us by @mrbrian _MVP. The utility cleans out superseded components in the component store and winsxs clean up as well and a host of other very useful settings. Unfortunately it does not do selective removal 🙁

      For further info if interested, see this thread leading to the program.

      ********** Win7 Pro x64 | Win8.1 Pro x64 | Linux Hybrids x64 **********

    • #2003890 Reply

      Alex5723
      AskWoody Plus

      cleanmgr is the tool of choice for cleaning up the component store (winsxs) …

      Still a few dozen GB too large to my tastes.

      Analyze and clean the WinSXS folder

      The size of the folder is not reported correctly however if you use Windows Explorer or third-party tools like WizTree to analyze its size.

      The reason for that is that it contains hardlinks which Explorer and third-party tools don’t take into consideration when calculating the WinSXS folder’s size (they count the hardlinked files even though they don’t reside in the WinSXS folder).

      These hardlinks point to files in other Windows directories, for instance c:\Windows\system32.

      https://www.ghacks.net/2016/03/14/analyze-the-winsxs-folder/

      How to cleanup the winsxs folder on Windows 7 (SP1)/ Windows 2008 / Windows 2008 R2 (SP1)

      How to cleanup the winsxs folder on Windows 7 (SP1)/ Windows 2008 / Windows 2008 R2 (SP1)

      • This reply was modified 1 month ago by  Alex5723.
      Attachments:
      • #2003940 Reply

        mn–
        AskWoody Lounger

        The size of the folder is not reported correctly however if you use Windows Explorer or third-party tools like WizTree to analyze its size.

        The reason for that is that it contains hardlinks which Explorer and third-party tools don’t take into consideration when calculating the WinSXS folder’s size (they count the hardlinked files even though they don’t reside in the WinSXS folder).

        Hardlinks are just fine, they’re a feature I’m well familiar with… and Sysinternals du counts them just fine, as do some versions of TreeSize.

        It’s just, there are a whole bunch of even things like amd64_microsoft-windows-f..truetype-couriernew_31bf3856ad364e35_6.1.7601.*_none and only one of those sets is hardlinked with the actually in-use instance – and not even the latest version number of that; amd64_microsoft-windows-os-kernel_31bf3856ad364e35_6.1.7601.*_none has 90+ versions… and fortunately the latest version hardlinked to the in-use instance.

        And then there’s things like @{ARCH}_microsoft-windows-ieframe.resources_31bf3856ad364e35_@{IE_VERSION}.@{PATCH_BUILD}_@{LANG} …Hundreds of those on disk. Yes, {amd64, wow64, x86} TIMES multiple language variants TIMES each version number …sure it does need all three architecture variants of all languages of the latest version, but anyway it does all add up even if I haven’t managed to collect all published versions.

        And no, this thing doesn’t seem to have /AnalyzeComponentStore or /StartComponentCleanup in DISM.EXE … never managed to use them with older than 8.x / Server 2012…

        If it were just a W7 workstation I’d just reinstall and be done with it, but a server where reboots have to be scheduled in advance and all that is a bit different. Not impossible, just a lot of bother. Same with throwing more hardware at it.

        Times like this I really miss good old “swmodify -x patch_commit=true” … I mean, even if I had to call that individually for each patch fileset… BTDT, with a script… right, have to look at Dism++ some more…

    Please follow the -Lounge Rules- no personal attacks, no swearing, and politics/religion are relegated to the Rants forum.

    Reply To: WinSXS cleanup manually instead of cleanmgr?

    You can use BBCodes to format your content.
    Your account can't use Advanced BBCodes, they will be stripped before saving.