Disk Cleanup with/without Desktop Experience in Windows Server 2012/2008/2016

Summary

How to cleanup disk in Windows server 2012 with or without desktop experience or powershell? This guide shares video and method to cleanup disk for server 2012 as an example and a tool to increase the disk space in server 2012/2016/2008 without data loss.

Andrew Wright

Updated on Sept 11, 2022

by Andrew Wright

How to enable disk cleanup with Powershell?

Disk cleanup button missing on Server 2012 R2 or Server 2008/2016? You will need to install a separate server component in this case. And that component is named Desktop Experience. You will have to use Powershell to do that.

  • Enter Powershell and make sure that everything runs properly
  • Use the “Install-WindowsFeature Desktop-Experience” command
  • Exit powershell and you should be ready to go. Restart only if necessary

Open command prompt, then add:

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\

Quick question: can we do disk cleanup without desktop experience? -> Yes, Partition Resizer can do the job in an easier way.

Run Cleanmgr.exe - Disk cleanup with powershell in Windows Server 2012 r2

Once you added the above cleanmgr.exe, you may start disk cleanup with cleanmgr.exe.

If cleanmgr disk cleanup powershell does not work for you or you want to know how to clean up disk without Desktop Experience, a third party tool like Partition Resizer is very useful as a replacement.

Option 1: run cleanmgr (valid after copying files or installing)

  • Step1 - Press Windows + R on your keyboard, type cleanmgr and press Enter.
  • Step2 - Select C: (or other) drive in the drop-down list and click OK.

Select drive

Option 2: via File Explorer (only valid after installing)

  • Open File Explorer, right click C drive and select Properties.
  • Click Disk Cleanup button in this middle.

The Windows server 2012 r2 disk cleanup powershell system works great if you want to clean up your disk and remove files that might take up up to 10GB disk space. More space needed? Try Partition Resizer Server that can add like 300GB or 500GB if there was free space on the disk without losing data.

The problem: What if you want to save more free space from the disk partition? Or you found Disk Clean up is not easy to use?

Solution: Clean up disk with Defragment and reallocate disk space with Partition Resizer Server without losing data. You can add as much disk space such as 100GB, 200GB or even more to any drive you want to expand.

How to clean disk/increase disk space with Partition Resizer Server Edition

IM-Magic Partition Resizer Server Edition does an amazing job at helping you clean up unnecessary data with Defragment in the software plus it could allocate disk space from one drive to another without losing data.

#1 - Clean up disk with Defragment in Partition Resizer for Windows Server

clean disk with defragment

This will automatically clean the disk temp file and trashes if you click the C drive as a target for defragment.

#2 - Extend Server C Drive with free space from another partition

Video - how to increase Windows Server partition volume size without losing data

IM-Magic Partition Resizer Server Edition ensures no downtime for Windows server if you extend a c drive and it is 100% data and OS safe with this tool.

download

[Guide] Steps to extend volume without data loss

This step by step guide will show you the way to extend any volume using IM-Magic Partition Resizer Server edition.

Step-1 Download install, and launch the program.

Step-2 Right click the large volume to produce unallocated free space.resize partition

Steps to increase disk partition spaceSteps to increase disk partition space

Step-3  Then right click c and drag the border to acquire the free space.right click server c drive to extend

Steps to increase disk partition space Steps to increase disk partition space

Step-4 Apply the changes. apply changes

FAQs

Q: How to run winsxs cleanup for Server 2012

A: Winsxs can be cleaned by the following cmd without losing data, please copy and paste the following cmd to the command window and run it.

run cmd to cleanup winsxs

Copy the following command lines to cleanup winsxs folder in CMD window.

  • 1. Dism.exe /online /Cleanup-Image /StartComponentCleanup
  • 2. Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase
  • 3. Dism.exe /online /Cleanup-Image /SPSuperseded

Video - how to cleanup winsxs folder on Windows

Or you may also use the following cmd to clean winsxs folder.

Dism /Online /Cleanup-Image /AnalyzeComponentStore

Dism /Online /Cleanup-Image /StartComponentCleanup

run cmd to cleanup winsxs

Video - how to clean up winsxs using disk cleanup or cmd

Q: How to delete temp files on Server 2012

A: Installing Disk Cleanup (cleanmgr.exe) on Windows Server 2012 R2 and run it would help remove temp files on Windows Server 2012. You may install disk cleanup with the following steps.

  • #1 - Open up Server Manager
  • #2 - Click 'Add roles and features' under Dashboard tab
  • #3 - Click 'Next' in the coming up window and all the next clicks until you see Features tab
  • #4 - Click User Interfaces and Infrastructure under Feature tab and open its sub-folder
  • #5 - Get DESKTOP EXPERIENCE selected in this process (THIS IS THE KEY TO ADD CLEANUP FOR SERVER 2012), and confim add features
  • #6 - Click INSTALL button.

You need to restart your computer to get it done.

And then you may come back to THIS PC, right click C drive -> Properties, and then disk cleanup option will be available for you to remove temp files and unnessary files on Server 2012.

Watch the following video again to see how to use disk cleanup in Windows server 2012

Related Product