Cealning up WinSxS folder?

Discussion in 'Windows 8' started by MonarchX, Apr 17, 2014.

  1. MonarchX

    MonarchX MDL Expert

    May 5, 2007
    1,272
    199
    60
    #1 MonarchX, Apr 17, 2014
    Last edited: Apr 17, 2014
    I originally had Murphy's install ISO that came with several scripts, two of which were:

    Clean-and-ResetBase-WinSxS-Folder.cmd
    and
    Clean-WinSxS-Folder.cmd

    However, I just format and installed a clean version of Windows 8.1 Pro VL with Update 1 integrated. All worked well, activated, no keys were required! After doing some research, I found that my WinSxS folder is huge! I did some research on the internet about that folder and I learned you can't just delete all files in WinSxS folder as it may severely damage your OS functionality. It did provide a method of doing some cleaning that SEEMS to be resembling the cleaning performed by the two files above...

    So, should I run either of the files above to clean that folder? I ran the thorough Windows Clean Up that was taking a while, but it did not show me any "Windows Update Clean Up" box to tick, nor did it reduce the same of my WinSxS folder... I did install all updates AFTER installing Win8.1 with Update 1 integrated. Does that do the same exact thing? I REALLY do not want to mess up this install because the last one got all crazy on me after permissions got messed up...

    I also tried using "Dism.exe /online /Cleanup-Image /StartComponentCleanup" from elevated CMD, but it told me that I cannot use 32bit DISM for 64bit OS. WTH? There is only one DISM.EXE, correct?

    Also, there are a few other scripts I saved, but I am not sure if I need to use them:

    Logout-to-Windows-Recovery-mode
    NetFX3-Online-Install
    Windows-Update-Download-Folder-Delete

    I installed Net Framework 3.5 already without any scripts, just by running as an Administrator, so I am not sure if I need the NetFX3 script? I am not sure about other scripts either...
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. murphy78

    murphy78 MDL DISM Enthusiast

    Nov 18, 2012
    6,787
    10,376
    210
    winsxs folder isn't as big as it reports.
    winsxs is usually only about 500-600mb when you don't count the hardlinked system files.

    The scripts I provided do exactly what they claim to do. I have no idea why you're having an issue running dism in normal admin prompt.
    You shouldn't... perhaps you're opening cmd prompt in a strange way? I always use winkey+X, then A

    resetbase just removes the hotfix uninstall information and makes things permanent.
    normal cleanup does the same thing as running cleanmgr and letting it remove windows update information (basically just removes superseded hotfixes)
    if you already installed netfx3, why would you try to install it again? When you wash your car, do you wash it again for no reason?

    update folder delete just stops the wuauserv service and deletes the softwaredistribution\download folder.
    If you aren't sure, don't use it.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. coromonadalix

    coromonadalix MDL Senior Member

    Jul 21, 2009
    416
    82
    10
    maybe off topic

    well i can't agree with that on windows 7

    In my actual Winsxs folder, i have 62545 files and a 6.2 gigs of thoses files

    In my previous attempt to clean those files my windows became unresponsive, and mostly the copy pastes functions became unresponsive, had to reinstall everything

    I have tried the script and had a multitude of windows opening and closing, could not kill this process with task manager because of those opening and closing windows so fast, could not click anything .....
     
  4. s1ave77

    s1ave77 MDL Guide Dog/Dev

    Aug 15, 2012
    14,963
    19,861
    340
    The Components Cleanup and ResetBase via dism only works on Win 8.x :g:.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. murphy78

    murphy78 MDL DISM Enthusiast

    Nov 18, 2012
    6,787
    10,376
    210
    Most people believe the same thing. The reason is that winsxs uses hardlinked files. This means that the file is represented twice on the hard disk, but only takes up one file's worth of space on the drive.
    Do you get it? It's the same file, just listed twice.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. coromonadalix

    coromonadalix MDL Senior Member

    Jul 21, 2009
    416
    82
    10
    in my case some of the files where represented 4 and 5 times .... but i assure you i had 6.2 gigs in this folder ...

    win 8 it was around a gig

    win 8.1 around 600 megs

    and for the script your right, it was designed for win 8 and up, but could not resist to click it before editing it loll
     
  7. murphy78

    murphy78 MDL DISM Enthusiast

    Nov 18, 2012
    6,787
    10,376
    210
    #7 murphy78, Apr 17, 2014
    Last edited: Aug 7, 2014
    You can reduce the size of the winsxs folder in win7 by running cleanmgr and pointed it at system files.
    It will compress superseded updates.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. LiteOS

    LiteOS MDL Expert

    Mar 7, 2014
    1,421
    538
    60
    #8 LiteOS, Apr 17, 2014
    Last edited: Apr 17, 2014
    most of winsxs are just dupes / backup
    so if u gonna run same batch file to remove files do it in all the image / c:\ dir

    i never test it deleting all winsxs but installation went fine without most of winsxs files
     
  9. coromonadalix

    coromonadalix MDL Senior Member

    Jul 21, 2009
    416
    82
    10
    #9 coromonadalix, Apr 18, 2014
    Last edited: Apr 18, 2014
    well well well

    having a spare computer for tests, a fresh install of win 8.1 update pro WMC gave me this in the winsxs folder

    5.73 gigs of 51,314 files,

    I ran the Clean-and-ResetBase-WinSxS-Folder.cmd

    It dropped to 5.29 gig of 12,419 files, after that the Clean-WinSxS-Folder.cmd did nothing more ???

    Very annoying behavior, to lose a mere +/- 10 % of my drive (combined with a 8,49 gigs of hibernate, swap, and the pagefile sys files) I find that hard to swallow :mad:

    I know hard drives are getting bigger and bigger but ..... :(


    EDIT : the clean manager found 2 megs of disposable files ....
     
  10. murphy78

    murphy78 MDL DISM Enthusiast

    Nov 18, 2012
    6,787
    10,376
    210
    You might try the wimboot feature if you're strapped for hd space.
    You can also powercfg -h off to turn off the hiberfil.sys 2g file
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  11. generalmx

    generalmx MDL Novice

    Apr 15, 2014
    34
    20
    0
    #11 generalmx, Apr 18, 2014
    Last edited by a moderator: Apr 20, 2017
    Because I was bored, I made up a size analysis of my Winsxs on my current Windows 8.1 x64 Pro w/ WMC install (note: originally Windows 8.0 RTM), using the CSV info from Sysinternals's "du.exe" (Disk Usage) program, counting hard links only once:
    winsxs.gif

    Edit:
    I think the take-away here is that modern Windows has a LOT of binaries it uses (16327 directories in my Winsxs), and Winsxs is the compatibility layer required to make it so we can all run programs without having to worry about downloading lib Foo first, something you'll find is often the case when you start going outside a select group of programs on Linux. And to remove that compatibility layer would mean death, as your average developer doesn't really think ahead to newer versions of operating systems and the libraries their own program uses.

    As for the person who got their Windows 8 64-bit Winsxs below 1GB, I'm skeptical; NetFX by itself is ~300MB. 32-bit Windows 8, maybe.

    Edit 2: Whoops, appears there's a handy command to actually do this analysis for you! Now I feel kinda stupid:
    Code:
    Dism /Online /Cleanup-Image /AnalyzeComponentStore
    
    Code:
    Deployment Image Servicing and Management tool
    Version: 6.3.9600.17029
    
    Image Version: 6.3.9600.16384
    
    [==========================100.0%==========================]
    
    Component Store (WinSxS) information:
    
    Windows Explorer Reported Size of Component Store : 6.62 GB
    
    Actual Size of Component Store : 6.41 GB
    
        Shared with Windows : 4.85 GB
        Backups and Disabled Features : 1.32 GB
        Cache and Temporary Data : 233.67 MB
    
    Date of Last Cleanup : 2014-04-15 06:23:52
    
    Number of Reclaimable Packages : 2
    Component Store Cleanup Recommended : Yes
    
    The operation completed successfully.
    Restart Windows to complete this operation.
    Do you want to restart the computer now? (Y/N) N