CleanMgr can nolonger be installed on server 2012 R2
You need to enable Disk Cleanup by installing theDesktop Experience
feature (see Enabling Disk Cleanup Utility in Windows Server 2012). The command line interface should still be available via the C:\Windows\CleanMgr.exe
executable.
I got back to my lab and tried grabbing CleanMgr.exe
and CleanMgr.exe.mui
from the x86 and WOW64 bit updates thinking that might fix the compatibility issue:
Copy-Item -Path C:\Windows\WinSxS\x86_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.3.9600.16384_en-us_f2763474b4405afa\cleanmgr.exe.mui -Destination C:\Windows\System32\en-US
Copy-Item -Path C:\Windows\WinSxS\wow64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.3.9600.16384_none_685740be65e399a2\cleanmgr.exe -Destination C:\Windows\System32
And the results...
Ah. The march of progress. I see two options. You can get ProcMon running and try to track down all the various DLLs in the WOW64 subsystem (maybe by doing a Desktop Experience
install on a throwaway server), you can try this method to remove the windows.old
directories if that's what is ailing you or you can follow Microsoft's officially supported albeit misguided recommendations and install it from the Desktop-Experience Windows Feature.
I had the same problem as Keith described for W2K12 R2 SP1 server. My solution for this problem:
- Install the desktop experience feature.
- Then you can see in SystemRoot\System32\en-US\cleanmgr.exe.mui and in SystemRoot\System32\cleanmgr.exe the new "cleanmgr" files, which are bigger as the files in the Winsxs folder
- Copy these files to another folder e.g. C:\
- Remove desktop experience feature, this will delete the cleanmgr files from system32!
- Copy the cleanmgr files from your folder(step3) to the known system32 locations (step2)
- Now you can run cleanmgr.exe
I use this procedure for making vmware template machines, so i did this once and all other future w2k12r2 server will have the cleanmgr files already installed
Copying directly from the c:\windows\WinSxS
directory, although once supported, now no longer works as-is. This appears to be a change within Windows Server 2012 R2 Update 1
a quick view of the cleanmgr.exe
binary in a hex editor reveals that the C:\Windows\WinSxS\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.3.9600.17031_none_5e3588b0315d2219\cleanmgr.exe
file is no longer begins with the required magic header "MZ...", instead it starts with "DCN..." and the file is much smaller than the expanded version. This is why we are getting the "unsupported..." dialog box above.
This appears to a direct result of KB 2821985 improvement #2 - Adds a feature that compresses unused binary files and allocates free disk space to prepare Windows for future updates.
Still trying to figure out how to extract/uncompress the files programmatically. :^(