Windows Server 2008 is something every admin likes to work with (sense the sarcasm over the Internet, Dr Cooper?).
The Problem
Believe me or not, but an essential (Windows) tool, cleanmgr.exe, is not present in Windows Server 2008 and Windows Server 2008 R2 by default.
This is by Microsoft’s, at the very least hard-to-explain, design, who likely believe it’s more of a desktop experience feature than a must-have tool.
Why on Earth would I want to install Windows Photo Gallery and Windows Media Player on a server just to have Disk Cleanup? Moreover, it requires a server restart.
Bonus: if you want to use WebClient service, you need to have Desktop Experience feature installed too.
The Solution
Windows Server 2008 (64-bit)
Copy the following files:
> copy C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.0.6001.18000_none_c962d1e515e94269\cleanmgr.exe C:\Windows\System32\
> copy C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.0.6001.18000_en-us_b9f50b71510436f2\cleanmgr.exe.mui C:\Windows\System32\en-US\
Run the cleanmgr.exe:
> cleanmgr.exe
Windows Server 2008 R2 (64-bit)
Copy the following files:
> copy C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.1.7600.16385_none_c9392808773cd7da\cleanmgr.exe C:\Windows\System32\
> copy C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.1.7600.16385_en-us_b9cb6194b257cc63\cleanmgr.exe.mui C:\Windows\System32\en-US\
Run the cleanmgr.exe:
> cleanmgr.exe
When I installed “Desktop Experience” for disk cleanup tool, it appears “0x800F081F” error. Your article helps me and it works. Thanks so much.
so much frustration over the years to remove those shitty updates setups without ruining the whole server
Please don’t do this to a production server…
https://blogs.technet.microsoft.com/askpfeplat/2014/05/13/how-to-clean-up-the-winsxs-directory-and-free-up-disk-space-on-windows-server-2008-r2-with-new-update/
Update May 15th, 2014
We are aware of a method of copying in the appropriate Disk Cleanup/CleanMgr files into the appropriate location to avoid installing the Desktop Experience. If this were a tested and supported option, we certainly would have included these details in this post and definitely would have used this method to automate the cleanup. However, it was determined early on that this method would not be supported. If you decide to do this, do so at your own risk.
Use Windows OS at your own risk.
Well then, how are we to install this necessary tool without the extra fluff? I have a production server that I need to run this on, and the Desktop Experience will not install no matter what I try. I’ve even tried the clean boot method and it still blows chunks..
This is a p*** poor design from Microsoft! They should be cleaning themselves up automatically! Especially after a cumulative service pack is installed!
https://technet.microsoft.com/en-us/library/ff630161%28v=ws.10%29.aspx?f=255&MSPPError=-2147217396
That is so brillian, both articles are published under the technet.microsoft.com domain, one saying “use it”, and another one saying “don’t use it”. Welcome to the Microsoft world.
I agree with KA. I have a production server that needs immediate attention and i have pending reboot on the server on the roles and features. How am i supposed to know what the app owners installed?
This will imply 3 reboots just to add this feature, except the “bonus” reboot…
Works like a charm, thanks
Sorry, I know the is old, but… what if after installing diskcleanup, it keeps saying “Disk Cleanup cannot clean up drive C:\. Make sure thar there is a disk in the drive.”
Yes, there is a disk in the drive. It’s the OS disk!!!
Ideas?
Thanks in advance
I don’t have Windows Server 2008 anymore, I won’t be able to help you on this one I’m afraid.
Thank you anyway.
No worries.
When I run it, it says I get 5 GB of extra space, but when it is finished running, I have unfortunately been 1 Gb less space, any idea?
Depending on what files have been cleaned up, you may need to reboot the server to reclaim the disk space.
Thx.
Thank you. :))
perfect! worked perfectly for me on server 2008 r2. no reboot needed! thanks
Superb!
Thank you!
The option worked. I had an x86 version of Server 2008r2. Unfortunately, it didn’t give me the “Advanced Options” that let you clean up things like old Windows update files and such.
This saved my bacon. I had next to zero disk space available and could not enable the desktop experience feature in order to get the disk cleanup utility. Thanks.
Thanks!
Coming to this late in the day where a client has run out of space on the C:\ drive.
If MS had NOT included the software that is something else, but to hide it and then wrap it up in “experience” where in production it is VITAL just stuns me, thinking about it, it shouldn’t, has there are many cases of valuable software wrapped of removed.
But the real reason of posting is to thank Thomas for including this valuable tip.
No worries, you’re welcome!
Yeah, I’m having disk space issues on an old Exchange server running 2008R2, I just need the darn thing to stay running for a couple more months while we migrate to the cloud. Thanks to your tip, I was able to run the tool. Thanks!!
Good luck with the migration!
Your article helps me so much :) it works well with Windows 2008 R2. Though needs to reboot the server to reclaim the disk space. But still fine coz I am having a headache already on the installation of desktop experience due to error 0x800F081F. God Bless You Tomas.
No worries, you’re welcome.
It’s a beautiful thing! Use this tip continually. Thanks!
Super handy! Thank you!
No worries, you are welcome!
Is there a similar process for copying the telnet.exe file when this Windows feature isn’t enabled within Server 2016?
Just install the feature. Unlike DE, Telnet Client does not require a reboot.
Or use a KiTTY.
Works Perfectly. Thank YOU !