Alan's sysadmin Blog

Working smarter not harder

Cleanup Winsxs after Windows 7 SP1 install

Posted by Alan McBurney on March 16, 2011

I recently noticed that the free space on the 60GB OS partiton on my laptop was running very low on space. Some of this was due to old offline files which I managed to cleanup fine.
I then ran Tree Size on the OS partition and found that the winsxs folder was 10.2GB.

After a bit of research I managed to use the command below and reduced the winsxs by 4GB :)

DISM /online /Cleanup-Image /SpSuperseded

The command needs to be run from an elevated command prompt and you cannot uninstall the Service Pack after it completes

I then did the same on my desktop and recoverd an almost identical ammount.

Pre CleanUp

Post Cleanup

Advertisement

55 Responses to “Cleanup Winsxs after Windows 7 SP1 install”

  1. Jamie said

    Worked a charm, actually dropped my winsxs folder down to 5.8GB from about 10GB,

    Many thanks Alan for your hardworking research and taking the time to post your solution!

  2. Seb said

    Great tip! No idea why they wouldn’t give you the option right after the installation. I got about 4 GB out of this which on my poor little SSD is pretty good going.

    Maybe you could put the command in string down so people can copy paste:

    DISM /online /Cleanup-Image /SpSuperseded

    Yes, I am that lazy.

  3. Paul said

    Wow… thank you very much for this!

  4. twpod said

    Thanks !! 4,3 Gb

  5. Mike P. said

    Thanks for posting this. Win7x64 with SP1 recently installed. This shrank the winsxs folder from 10.5 to 6.5GB. That’s a nice chunk of valuable space on my SSD!

  6. Jimmy Gibbs Jr. said

    Thanks a lot!

  7. Mike Thompson said

    Only recovered about 1.5 GB from my XenDesktop image. But this is EXACTLY what I have been looking for. Excellent!

  8. Mikey said

    My thanks also. Totally agree with Jamie. Down from 9.4 to 6.0 gig.
    (Nice post date Jamie. :o ) )

  9. Steve said

    Very effective. Worked well.

    Thanks!

  10. Parag said

    Any similar command for vista?

    • Alan McBurney said

      Sure although it depends on which SP you are running as the commands vary.
      For SP1 use vsp1cln.exe and for SP2 its compcln.exe, both tools are located in %windir%\system32

      Good to see MS making things easy and transparent :)

      Alan

  11. Michoko said

    Thanks a lot! Reduced the winsxs folder by 4 GB too! :)

  12. Salin said

    While I tried to do it i shows the
    Error 87
    The spsuperseded option is not recognized in the context.
    For more information, refer to help.
    The DISM log file can be found at C:\Windows\Logs\DISM\dism.log

    Please help me.

    • Alan McBurney said

      Was your OS installed using media that already had SP1 or was the SP installed onto the RTM Windows 7?

      • Boushi said

        I am having the exact same issue. My Harddrive was wiped clean and had Win7 installed on it. Currently my winsxs folder is taking up 15.5 gigs on my 20 gig harddrive that is specific for Windows and I install programs onto a different harddrive.

    • Jase said

      error 87 is apparently a spelling error, check you have typed command correct, spelling/spaces etc, worked for me ;)

      • SquallV said

        I also have the same problem and double checked the command over 6 times and its stil giving the same error x.x. someone help please!!

    • Gary said

      Make sure you cd to the Windows\system32 folder first.

  13. Fabio said

    Very useful.
    I save about 4 GB of space !
    Thanks

  14. Ismael Glez. said

    Thanks!

    I did it and it saved 1.81 Gb.
    :D Cool site!

  15. bear187k@gmail.com said

    Thanks for the info – I was able to reclaim upwards of 20GB from that greedy folder!

  16. subbu said

    nice one, thanks Alan.

  17. chris said

    took back 9 GB but my used space stays the same for the drive?

  18. Roee said

    Wow!!!….
    winsxs went from 10.2G to 6.45 G…
    10x a lot from Israel…..

  19. Jeff said

    Went from 10.5GB to 6.5GB. Thanks!

  20. Nir Levy said

    Thanks for the tip. Gained 2Gb.

  21. kizzx2 said

    Great, worked like a charm. Thanks!

  22. Changis said

    You might have to wait a few minutes after it reaches 100% atleast in my experience

    • Frank said

      Yeah, even takes a good while for the progressbar to appear…
      Reduced my winsxs folder from 11gig to 6,6gig =) Thank you very much

  23. ejsik said

    Gained 4,4GB.
    Thanks!

  24. outseeker said

    4GB recovered! TY!! :D

  25. paul said

    Same error as Salin. Could you please advice?

  26. Dave W said

    Hi,
    The same action can also be performed using the disk cleanup tool included with Vista/Win7
    Regards,
    Dave

    • Alan McBurney said

      Its true that the Disk Cleanup Utility can be used to clean up system files on Windows 7 although the same isn’t true for Windows 2008 R2 unless you install the Desktop Experience feature which doesn’t sit well with many server admins.

      The article (although not explicitly defined) was aimed at both Windows 7 and Windows 2008 R2

      So if you need to cleanup the SP on Windows 2008 R2 without installing the additional features the only way is via the above command.

      I also much prefer the command as it gives you some idea of the cleanup progress

  27. Gaurav Goyal said

    Windows System Cleanup does the same job.

    Right click on a drive, select Properties and follow the options -> Disk Cleanup -> Cleanup System files -> Select Service Pack backup from the list.

  28. worked as a charm, saved 3.5GB
    Thanks a lot

  29. [...] Cleanup Winsxs after Windows 7 SP1 install « Alans sysadmin Blog. Share and [...]

  30. Nathan said

    Knocked 3GB of crap off. 9GB -> 6 GB.

  31. leni said

    Большое СПАСИБО !!!
    Папка winsxs уменьшилась на 2,5 Гб
    Ура !!!!!!!!

  32. You’re a life saver. Your post actually works than the one posted in microsoft’s website. :)

    Thanks a lot!

  33. This doesn’t work on Win7 without SP1 (see Salin’s message for details). On my system, this folder is already so huge I simply don’t have any more free space on C:, less than the minimum necessary to install SP1. Any ideas how to do it without SP1?

  34. Thanks a lot work very fine with me, thanks again.

  35. is there any command to free up remaining 6 gb

  36. BBO72 said

    I get following :

    C:\Windows\System32>dism /online /cleanup-image /spsuperseded

    Deployment Image Servicing and Management tool
    Version: 6.1.7600.16385

    Image Version: 6.1.7601.17514

    Service Pack Cleanup can’t proceed: No service pack backup files were found.
    The operation completed successfully.

  37. lokiki said

    you saved me almost 6Gb on my 11.7Gb folder, great trick !
    Cheers from France and merry christmas

  38. From 10.5 Gb to 6.5 Gb
    Thnx man…

  39. Thanks for the helpful tip.

    Almost need to automate this process for customers because it is an ongoing concern!

  40. xpanmanx said

    Zoinks! 10.8GB to 1.9GB. Thank you! :)

  41. Andy said

    Cut the folder size in half! You’re my hero!

  42. ktell said

    sweet doggies. Now on to the “Installer” folder.

    Thanks dude!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

Join 79 other followers