More

Missing disk cleanup utility in Windows Server “Fix”

By Antti Hurme 03/12/2013 25 Comments 1 Min Read

Microsoft has for some reason left Disk Cleanup utility as a Desktop Experience component in the previous Windows Server 20xx editions which has made quite a few of us sad, me included. Made a quick script to make my life quite a lot easier as the files are available but not just in the right place. This simple fix will copy the disk cleanup required files to the correct location. There’s no need to install the Desktop Experience package to the server, there are no required DLL’s included or any registry edits.

Windows Server 2012R2 doesn’t work at the moment due to incompatibility with 16-bit applications. “Unsupported 16-Bit Application: The Program or feature “??\c:\windows\system32\cleanmgr.exe” cannot start or run due to incompatibility with 64-bit version of windows”

Serverfault discussion of the error  here.

Currently supported Operating Systems:

  • Windows Server 2008 x86
  • Windows Server 2008 x64
  • Windows Server 2008 R2
  • Windows Server 2012

Note: If you are unsure of the code, just open the batch file in notepad.

Microsoft Technet Source

Microsoft KB 2852386 is required if the script doesn’t work.

What’s New

v1.1
– Cleaning of code
– W2012 Fix
– Mixed printout messages

Written By

Who am I? | Linkedin

View All Articles
G
H
25 Comments
  1. mike says:

    Thank you!

  2. Dillon says:

    Thanks for that – saved me some time!

    1. Antti Hurme says:

      You’re welcome!

  3. Simon says:

    Hi there – any chance of a version for SBS 2011?

    1. Antti Hurme says:

      At the moment I don’t have access to SBS2011, if you can provide me with the locations I will add them to the script.

  4. Harro says:

    Cheers for the script.
    Unfortunately, this does not seem to work yet for 2012R2.

    When I found the proper locations for the mui and exe, added these to the script, ran the script succesfully but then the error appears that “these versions are not supported”.
    Even when copying the exe and mui from my 2012R2 terminal server with Desktop Experience installed, where disk cleanup works fine, Disk Cleanup runs but does not find any “old windows installations (windows.old)” or windows updates cleanup.

    Bummer!

    ps: you made a minor mistake in echoing the “copying mui” while copying the exe and vice versa ;)

    1. Antti Hurme says:

      I will update the script with W2012R2 soon :)

  5. Eric Nemchik says:

    C:\Windows\WinSxS\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.3.9600.16384_en-us_4e94cff86c9dcc30

    C:\Windows\WinSxS\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.3.9600.16384_none_5e02966c3182d7a7

    1. Antti Hurme says:

      Thank you for this, I will update this script as soon as possible.

  6. Eric Nemchik says:

    also on line 44 you have x86 where it should be amd64

    C:\Windows\WinSxS\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.2.9200.16384_en-us_b6a01752226afbb3

    can anyone confirm that there is no such thing as 32bit 2008r2 or 32bit 2012 or 2012r2? I havent seen anything but 64bit in these flavors.

    1. Antti Hurme says:

      There is no 32-bit edition of 2008R2 or newer, the last 32-bit server OS was Windows Server 2008.

  7. Beny says:

    Thank You, With this you have extend the life of me and my machine. Nice.

  8. Brian says:

    Super big thanks!

  9. Karim Kronfli says:

    Thanks for the script.

    I tried it on Server 2012 fully patched to date and it has a couple of problems

    Firstly the echo commands are the wrong way round. Secondly the location of cleanmgr.exe.mui appears to have moved to
    C:\Windows\WinSxS\x86_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.2.9200.16384_en-us_5a817bce6a0d8a7d\

    Finally and this is the kicker for soe reason the additional functionality to clean the system areas such as WinSxS does not appear unless I have installed “Desktop Experience” Any hints?

    1. Antti Hurme says:

      Thank you for this, I’ve noticed some issues with this as mentioned and will try to fix them sometime soon.

    2. Antti Hurme says:

      The script now works correctly with 2012.

  10. John says:

    Huge thanks for this. I appreciate you spending your time scripting this out!

  11. bar2d2 says:

    I just tested the script on W2012 R2, and it does not work

    1. Antti Hurme says:

      Like mentioned in the post itself, this doesn’t work with 2012 R2. It only works with previous versions of Windows Server.

  12. Jeremy says:

    Great script!

  13. x says:

    found this didn’t work with windows 2008r2 without installing KB2852386 first

  14. Prashant says:

    Waav !! Tech Guru .. you rocks.

  15. Cougar says:

    Hi,
    I was halfway through writing the same script just now when I suddenly thought “I wonder if anyone else has done this?” and hey! Cool, that saves me a job.

    Looking at the code though, there seems to be a logic issue in the case of the OS not being matched to the VER output. i believe you need an EXIT at the end of the :failed block to stop it cascading down into the server 2008 code (and also possibly remove the systeminfo check, that’s also cascading and doesn’t seem to be doing anything?)

    Cheers.

  16. Tibor says:

    I will give a try now on Sbs 2011

  17. JCMilleniuM says:

    Hello, it does seems to erase some files on the app however the files on the winsxs folder remain without deletion, is there a safe way to remove them without affecting anything else?

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.

This site uses Akismet to reduce spam. Learn how your comment data is processed.