Windows 7 Thread, Script / tools - automatic disk cleanup for Windows 7 clients in Technical; Another post for those of you looking for a particular handy tool: I have just managed to automate Windows 7 ...
1. ## Script / tools - automatic disk cleanup for Windows 7 clients

Another post for those of you looking for a particular handy tool:

I have just managed to automate Windows 7 disk cleanup for clients, using this guide Breaking News! Reduce the size of the WinSxS Directory and Free up Disk Space with a New Update for Windows 7 SP1 Clients - Ask Premier Field Engineering (PFE) Platforms - Site Home - TechNet Blogs

I now have two GPOs which I can apply to my clients, one runs the script:

Code:
Dism.exe /online /Cleanup-Image /StartComponentCleanup /SPSuperseded
The next uses the settings from the technet guide.

Run cleanmgr.exe /sageset:n on your Windows 7 PC (where n is you chosen set number, anything from 1 to 256)
Tick the options you'd like to clean up on clients. Click OK.
Go into the registry on your PC, go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Curr entVersion\Explorer\VolumeCaches
Export the reg keys (right click / Export) for the options you ticked. You don't need the keys for the ones key left unticked. Place them in a network share.
Push them to your clients, e.g. with a startup script:

Code:
regedit /s \\\server\share\cleanup\dpf.reg
regedit /s \\server\share\cleanup\icf.reg
regedit /s \\server\share\cleanup\pi.reg
regedit /s \\server\share\cleanup\rb.reg
regedit /s \\server\share\cleanup\spc.reg
regedit /s \\server\share\cleanup\tf.reg
regedit /s \\server\share\cleanup\uc.reg
regedit /s \\server\share\cleanup\udf.reg
The names for each .reg key above were names that I chose, relating to each setting to export.

Now run:

cleanmgr.exe /sagerun:n (you can run this as a startup script, scheduled task etc).

You'll want to restart the client PCs under some control, as it takes a while and kids love to turn the PCs off.

Once it has restarted, check your disk space. It freed up 7GB for me, on a 60GB SSD that's pretty handy! Hope this helps someone. Remember, once you run this, your Windows updates etc will be locked in. Don't run it shortly after an update rollout, you may well regret it!

2. ## Thanks to 3s-gtech from:

Chuckster (19th June 2014)

SHARE: