Thursday, February 13, 2014

PowerShell Script to Restore cleanmgr on Windows Server 2008 R2

Windows Server 2008 R2 is without a doubt my favorite server OS. It replaced w2k3r2 for me (because no one liked 2008, amirite?) and I'll venture to say that its stability is the primary reason for the lagging adoption of Server 2012 (and 2012 R2 for that matter). 10 years from now, it will be the Windows XP of the Server world.

But there's one major annoyance with w2k8r2: cleanmgr.exe isn't enabled by default. I finally had enough of manually moving cleanmgr.exe and cleanmgr.exe.mui into the correct directories from within winsxs, so I fired up PowerShell ISE and wrote a two line script to automate that task for me.

To be honest, I just wanted an excuse to fool with PowerShell a bit. I don't spend enough time with PS, and want to fix that.

So here's the script, two lines of PowerShell glory:

You can probably do this in one line, right? If so, let's see it!