Windows OS Hub
  • Windows Server
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2012
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Group Policies
  • Windows Clients
    • Windows 10
    • Windows 8
    • Windows 7
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
  • PowerShell
  • Exchange
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2012
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Group Policies
  • Windows Clients
    • Windows 10
    • Windows 8
    • Windows 7
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
  • PowerShell
  • Exchange

 Windows OS Hub / Windows Server 2008 R2 / Disk Cleanup on Windows Server 2012 / 2008 Without Installing Desktop Experience

February 23, 2017 Windows Server 2008 R2Windows Server 2012 R2

Disk Cleanup on Windows Server 2012 / 2008 Without Installing Desktop Experience

By default, in Windows Server 2008 / R2 and 2012 / R2 there is no Disk Cleanup (cleanmgr.exe) utility that allows to delete unused files and clean up the WinSxS folder and component store from the files of updates that are no longer required. To run it, first you have to install a separate server component Desktop Experience using either Server Manager or PowerShell (Install-WindowsFeature Desktop-Experience).

Tip. To use cleanmgr to delete deprecated updates on Windows 2008 R2 / Windows 7 SP1, install KB2852386.

Together with Desktop Experience, many other unnecessary components are installed on the server:

  • Windows Media Player
  • Desktop themes
  • AVI support for Windows
  • Windows SideShow
  • Windows Defender
  • Disk Cleanup
  • Sync Center
  • Audio recording
  • Character Map
  • Snipping Tool

Desktop Experience feature on Windows server 2012 R2

To run Disk Cleanup on Windows Server, you can use an easier method: just copy two files Cleanmgr.exe and Cleanmgr.exe.mui from WinSxS to system directory. You can see commands to copy these files in different Windows versions below.

Windows 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\

Windows Server 2008 x64

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\

Windows Server 2012 x64

copy C:\Windows\WinSxS\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.2.9200.16384_none_c60dddc5e750072a\cleanmgr.exe C:\Windows\System32\

copy C:\Windows\WinSxS\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.2.9200.16384_en-us_b6a01752226afbb3\cleanmgr.exe.mui C:\Windows\System32\en-US\

To start Disk Cleanup, run cleanmgr.exe command with the administrator privileges. copy cleanmgr.exe on windows server 2008 r2

Windows Server 2012 R2 x64

The method described below doesn’t work in Windows Server 2012 R2 due to the changes made by KB2821895 update. The matter is that after you install this update, compression is used to store the binary files of the components. When trying to run the copied cleanmgr.exe, the following error appears:

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

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

As a workaround, you can use this method:

  • Install Desktop Experience: Install-WindowsFeature Desktop-Experience
  • Restart your server
  • Copy the files %windir%\system32\cleanmgr.exe and %windir%\system32\en-US\cleanmgr.exe.mui to any directory (c:\temp)
  • Uninstal the feature: Uninstall-WindowsFeature Desktop-Experience
  • Restart
  • Copy the files cleanmgr.exe and cleanmgr.exe.mui to the directories mentioned above

Later both of the files can be copied to other servers or integrated into Win 2012 R2 virtual machine templates.

Tip. To delete the obsolete updates in Windows Server 2012 R2, it’s easier to use the following DISM command:
dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase

3 comments
0
Facebook Twitter Google + Pinterest
previous post
Calculating the Number of Client Access Licenses (CAL) for Exchange Server
next post
Activating Windows Server 2016 with KMS Server

Related Reading

How to Backup Hyper-V Virtual Machines?

December 10, 2019

How to Measure Storage Performance and IOPS on...

October 30, 2019

End-of-Support Notification in Windows 7

October 30, 2019

Installing SFTP (SSH FTP) Server on Windows with...

October 2, 2019

How to Approve and Decline WSUS Updates?

September 26, 2019

3 comments

Jimbo March 27, 2019 - 5:02 pm

March 2019 – Had to run the cleanup on 2012 R2 server with desktop experience still installed. Didn’t work with just the files copied.

Reply
Shey July 8, 2019 - 6:44 am

It works with Windows 2008R2. Thanks a lot. God Bless.

Reply
Hans Müller November 25, 2019 - 10:03 am

Does not work in Windows Server 2012 x64:

When i execute `copy C:\Windows\WinSxS\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.2.9200.16384_none_c60dddc5e750072a\cleanmgr.exe C:\Windows\System32\`

I get that message:

“C:\>copy C:\Windows\WinSxS\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.2
.9200.16384_none_c60dddc5e750072a\cleanmgr.exe C:\Windows\System32\
Das System kann den angegebenen Pfad nicht finden.

C:\>”

WTF??

Reply

Leave a Comment Cancel Reply

Categories

  • Active Directory
  • Group Policies
  • Exchange
  • Windows 10
  • Windows 8
  • Windows 7
  • Windows Server 2016
  • Windows Server 2012 R2
  • Windows Server 2008 R2
  • PowerShell
  • VMWare
  • MS Office

Follow us

woshub.com

Recent Posts

  • VMWare: How to Find VMs by IP or MAC Address?

    December 13, 2019
  • The Disk is Offline Because of Policy Set by an Administrator

    December 12, 2019
  • How to Backup Hyper-V Virtual Machines?

    December 10, 2019
  • How to Change a Network Location from Public to Private on Windows 10/Windows Server 2016?

    December 9, 2019
  • Configuring Storage Replica on Windows Server 2016

    December 4, 2019
  • Windows 10 Install Error 0x80300024

    December 2, 2019
  • Running PowerShell Script (*.PS1) as a Windows Service

    November 27, 2019
  • Creating Multiple Partitions on a USB Drive in Windows 10

    November 26, 2019
  • VMWare vSphere: Failed to Upload Files to Datastore

    November 21, 2019
  • How to Delete Old User Profiles Using GPO and PowerShell?

    November 19, 2019
  • Facebook
  • Twitter
  • RSS
Popular Posts
  • Fix: Server Stuck on “Preparing to Configure Windows”
  • Windows.edb File Too Big – How to Reduce Size
  • Fix: Can’t Boot After Accidentally Deleted System Reserved Partition
  • Remote Desktop Connection Error: Outdated entry in the DNS cache
  • Windows Update Error 0x80244022 and WsusPool Memory Limit
  • Unable to Install Print Driver after KB3170455
  • How to Filter Event Logs by Username in Windows 2008 and higher
Footer Logo

@2014 - 2018 - Windows OS Hub. All about operating systems for sysadmins


Back To Top