Here we will create a task to run Disk Cleanup. In "Create Task" the Name and Description are optional. "Run whether user is logged on or not", "Run with highest priveleges" should be checked, and the task "Configure for:" should be your installed version of Windows.
Next click on the Triggers tab, and a new dialog box will open.
Disk Cleanup is a task to be run periodically, so we can leave "On a schedule" in the dropdown. The "Start:" date and time will always be the current date and time, but you can change that to whatever you wish. Weekly is enough for Disk Cleanup, and I've selected Sunday at 1:00 AM. I've also checked "Stop task if it runs longer than:" and selected 8 hours. Make sure that there is a tick in "Enabled".
Once the triggers are to your liking, click OK. The Triggers dialog box will close and you will return to the "Create Task" dialog box. Then click the "Actions" tab, and "New".