One utility that has proved useful to me in the desktop edition of Windows is the Disk Cleanup tool, also known as cleanmgr. When invoked from a command line or batch script, it lets you perform various automated disk-cleaning operations such as emptying the Recycle Bin or removing temporary files from user directories. Being able to automate these things in Windows Server is handy, but anyone who tries to invoke cleanmgr from a command prompt in Windows Server 2008 will receive the generic "not recognized" error. What's going on here?
As it turns out, cleanmgr has not been removed entirely from Windows Server 2008. That's the good news. The bad news is, it is not set up by default. Cleanmgr and a slew of other programs including Windows Media Player (in case you're wondering why you couldn't find that in Windows Server 2008 either), are contained in a set of add-ons collectively labeled the
Some of these features are useful on a server. Disk Cleanup is certainly one of them, but there are a few others including: the Snipping Tool, the Character Map, the aforementioned Windows Media Player and the Sound Recorder. The Character Map, in particular, is one worth keeping handy. For instance, it helps when dealing with user names in Active Directory that have accent marks or other punctuation marks that aren't accessible from a conventional keyboard.
There's two ways to install Disk Cleanup in Windows Server 2008. The first, and the more straightforward approach, is to install the Desktop Experience from the Add Features wizard (in Server Manager > Features). Keep in mind that this installs all the Desktop Experience components; there's no way to individually select which pieces to install. What's more, installing Desktop Experience automatically triggers the installation of another component you might not want, like the Ink and Handwriting Services subsystem. Adding any component to a server, even one not actually used, increases the attack surface. The less unused features you have hanging around in a server installation the better.
The other way to add Disk Cleanup is to manually copy it out from the Windows installation directory. This approach requires a little more care to be taken because it involves typing out long pathnames. Note also that if you are running the 32-bit version of Windows Server 2008, unlikely as that may be, the files will need to be copied from a slightly different location. Once copied, cleanmgr runs as it normally does, including the use of its command-line switches to store and recall different task settings.
ABOUT THE AUTHOR
Serdar Yegulalp has been writing about personal computing and IT for more than 15 years for a variety of publications, including (among others) Windows Magazine, InformationWeek and the TechTarget family of sites
This was first published in July 2011