I know, I know — we shouldn’t use this on servers. Sometimes though, in the right environment and for the right reasons, it can be useful (and you don’t have to install something like ccleaner).
This process is honestly, really easy — the files are already on your system, they just need to be put in the right place. Take these lines below and either run them one at a time with an administrative command prompt or put them in a batch file and run all at once.
Server 2008 R2 x64:
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
These three lines will copy the needed files from your sxs folder and put them in your system32 which will allow you to call “cleanmgr.exe” from the command line.
I hope this makes your day at least a little bit easier!