CASE: for basic maintenance such as disk defragmentation and disk cleanup we want to use Scheduled Tasks.
Enable Disk Cleanup (not there by default):
1) Disk Cleanup for Server 2008: go to “Server Manager” – “Features” – “Add Features”
2) Select “Desktop Experience”
3) Reboot Server
Create settings for disk cleanup:
1) go to start CMD (run as administrator)
2) create a registry key with your settings: C:> cleanmgr.exe /sageset:n (n – select a number)
3) check all options
Create Scheduled task:
1) go to “Task Scheduler“
2) go to menu “action” and select “create basic task“
3) set name (for ex. “Monthly Disk Cleanup“) – NEXT
4) trigger: Monthly – NEXT
5) monthly: select all months / on: last + sunday / set hour (01:00 am) – NEXT
6) “start a program” – NEXT
7) browse for cleanmgr (ex. C:\Windows\System32\cleanmgr.exe)
8) add argument: “/sagerun:n“
REMARK: you could add a task for defragmentation a few hours after the disk cleanup.