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

94 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. Jimmy Gibbs Jr. said

    Thanks a lot!

  6. Mike Thompson said

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

  7. 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!

  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.


  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 🙂


  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!!

      • The free radical said

        dism /online /cleanup-image /spsuperseded

        this is the exaxt syntax…..U need to add spaces between the words and the slashes….

      • I got my laptop with Windows 7 and SP1 already installed, and I get the error 87 as well… I’ve checked the spelling, and I paste the command at c:\windows\system32\> yet it still doesn’t work… what can I do? My winsxs is 11GB…

      • sharjeel said

        i have also the same problem.plz some body help

      • Myk said

        My ‘spelling mistake’ was to spell last switch using a a ‘c’, make sure you have spelt it with an ‘s’;

    • Gary said

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

    • Nate said

      Had the exact same issue, went away after I installed SP1.

    • thunder said

      Don’s miss the space after each command.

    • Peter said

      i had the same trouble….error 87, put SP 1 and updates in…….all good

  13. Fabio said

    Very useful.
    I save about 4 GB of space !

  14. Ismael Glez. said


    I did it and it saved 1.81 Gb.

    😀 Cool site!

  15. 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

    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.

  24. outseeker said

    4GB recovered! TY!! 😀

  25. paul said

    Same error as Salin. Could you please advice?

  26. Dave W said

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

    • 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!

  43. Kaloyan Nikolov said

    God, mine is 7gb and when i do this it says there’s nothing to clean.

  44. Knight said

    From 6.78 Gb to 4.60 Gb

    Thank you

  45. touranaga said

    Running 64bit Win7 Professional and I ran the option form the C:\Windows\system32>
    worked like a charm!! cleared about 3GB
    Thank you very much you just save my fragile Acer Aspire S3 with the mighty 20GB of SSD…
    millions of gratitude
    Running 64bit Win7 Professional and I ran the option form the C:\Windows\system32>

  46. umair shaikh said

    in my case it says “the spsuperseded option is not recognized in this context

  47. […] winsxs I found some good tips (here and here) on reducing the size of the winsxs […]

  48. […] Here is the link on how to clean up that leftover backup files and get back 4gb or more: ( […]

  49. how to be a blogger…

    […]Cleanup Winsxs after Windows 7 SP1 install « Alan's sysadmin Blog[…]…

  50. Jacob said

    Thank you very much; Winsxs folder went from ~10GB to 6.53 GB.

  51. Honusnap said

    Well really strange …
    Run the command before installing SP1 => No effect, Winsxs remains at 5.45Gb.
    Installed SP1, Winsxs becomes 6.7Gb
    Run the command, Winsxs becomes 4.5Gb .. !

    => Should i install SP1 and run the command again …. 🙂

  52. David W. said

    Thanks!!! 15.5 to 7.7!

    BTW…”Elevated Prompt” = “Run as Administrator”.

  53. Ameen Harun said

    Thank you so much ! I used SSD for my main c: drive to speed things up. With SSD the space is on the premium side and reducing winsxs helped a lot !

  54. John E said

    Thanks heaps. My winsxs was using 13GB but I have it down to 7.7GB after running the DISM command you suggested.

  55. Amit Kamrani said

    Thank you so much. Much appreciated…:)

  56. Phil said

    Thanks a lot you’re a life saver =)

  57. […] @Alan’s sysadmin Blog Posted in News, Tools – Tagged HowTo, Tips, Winforms SHARE THIS Twitter Facebook Delicious StumbleUpon E-mail « [HowTo] Write Excel file to web page (aspx) No Comments Yet […]

  58. MeChicago said

    Thanks for the tip, this worked great. It freed more than 3gb from my SSD just wish there was a way to clear the rest out. All the subs in the winsxs folder have a amd prefix, and im not running an amd 😦

  59. SvenNilsson said

    Awesome, my 20GB disk was so damn full after installing Win Server 2008 R2, that I thought about giving up. Now I have 3GB free.

  60. fernando said

    why i found error : 740
    please help me

    • Xee said

      You need to run it from an elevated command prompt. Follow the instructions below:

      1. Open the Start Menu.

      2. Click on All Programs and Accessories, then right click on Command Prompt and click on Run as administrator.

  61. felipe said

    Muy buen aporte me funciono graxias….

  62. DrStrangepork said

    What I’d like to know is why the winsxs directory is STILL >6G after you cleaned it up! I have absolutely no intention of ever uninstalling any Update or Service Pack, so how can I get this directory as close to 0 as possible?

  63. Matt said

    This worked great. Cut my winsxs folder forom 11 GB to 6.7GB. Thanks so much.

  64. […]  cleanup c:windowswinxsx ( winsxs folder ) as it was too big. Used this command (run as […]

  65. Mr.Hostile said

    Works fine i got 14GB now is 10GB but i wait for 3 hours to get exactly the same screanshoot of command prompt

  66. Nick said

    Fantastic advice. Saved over 6 GB from a very crowded 14GB winsxs file. Thanks!

  67. Nikita said

    Only copy it and add to cmd
    DISM.exe /Online /Cleanup-Image /spsuperseded

  68. Kevin M said

    Thank you so much! I’m careful about my C: usage, but had no choice but to install premium versions of some development tools that I knew would eat C: up. I hate to see red in the drive usage bars, and prefer to have 15% unused so defrag can do it’s thing. This did the trick beautifully, and I wish Microsoft would just make something like this part of its updates! Thanks again!

  69. pablo said

    From 16,8G to 9,33G! Thank you!

  70. […] Source: […]

  71. […] […]

  72. […] […]

  73. Phil said

    Worked really well, exactly what I was looking for, thanks

Leave a Reply

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

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

Google photo

You are commenting using your Google 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

%d bloggers like this: