This tip is for the server administrators out there with messy disks on Windows Server 2008 and 2012.
I just finished upgrading all of my lab infrastructure to the newest coolest and cloudiest server OS, Windows Server 2012. I did an actual upgrade also, not a custom installation. The difference being that an upgrade will keep your files and folders in place so you do not lose any data; while a custom install will format your system disk.
The upgrade finished without a hitch on all on my machines; 2 domain controllers, 2 Hyper-V servers and a storage server. The only issue was that on all of my system drives I was running out of room, on account the system drives are SSD or virtual hard drives.
When you do an upgrade instead of a custom installation the machine will end up with a folder on the root of the system drive, normally C: called Windows.old. This is the old version of Windows and unless you have some files saved in the Windows or Program Files folders you can safely delete this after the upgrade is complete. Note that any files saved in the user profiles location will be copied to the new installation.
Only problem with deleting the Windows.old folder is that if you try to just delete the folder you will receive nasty errors and warnings like these.
Now you could go into the permissions and take ownership of all of the files and get through the system file warnings, but it would be much easier if you could just use Disk Cleanup Wizard to delete the old folder. Plus you get the option of deleting other non essential and temporary files with Disk Cleanup. Now to run the cleanup right-click the disk and select properties and there should be a button next to the pie chart of the disk, oops, it's not there!
If you search for missing disk cleanup on Windows Server, you may end up at this Technet page; http://technet.microsoft.com/en-us/library/ff630161(v=ws.10).aspx. Which directs you to copy files from crazy Windows\WinSxS locations and run the Cleanmgr.exe program. I will have to track down how this got published, but just know that it is not a good practice to just go copying files from the Windows Component Store (WinSxS) willy nilly. Plus if you do this the button will still not be shown on the disk properties. So how do you get the disk cleanup back the right way?
The Desktop Experience feature is the feature that enables disk cleanup on Windows Server 2008 and 2012, so just install this feature and you can cleanup you disk as much as you want.
In Windows 2008 use Server Manager to add the feature.
In Windows Server 2012 it's even easier, use PowerShell to enable the feature.
Now the button is back and you can delete the folder.
Now go clean you disks before the next tip!
but I think a reboot ist required after installing the feature?
Thank you. This is very helpful for clean freaks like me.
Thank you. This is very helpful.
Reboot definitely required afterwards
no desktop feature in 2012 r2
with PS you can install the feature.
Was able to get the Disk Cleanup to appear via the PS command on my 2012 R2 server. However, I don't see the "Previous Windows installation(s)" check box mentioned in http://windows.microsoft.com/en-us/windows7/how-do-i-remove-the-windows-old-folder. :(
Never mind, just figured it out. I had to press Windows, then did a search for Disk Cleanup, ran the application as administrator.
So you need to install a feature that does not have his place on Server in order to remove a folder? Well..
I found another solution and keep the server " clean", boot on a Windows Installation Disk > Shift + F10 > rd /s /q :)
Why was Disk Cleanup removed in the first place? Seems illogical to remove a useful feature and then have to jump through rings of fire to locate and restore it.
You can also run the disk cleanup from command line, see Cleanmgr.exe /? for more information.