Clear, practical technology insights BSOD Code Lookup · Windows Error Code Lookup · Wi-Fi Troubleshooting · PC Troubleshooting Checklist

How to Schedule Windows Maintenance With Task Scheduler

Create a scheduled Windows task, run a saved Disk Cleanup profile, confirm it completed, or use Storage Sense for routine space cleanup.

Table of Contents

Use Task Scheduler when a maintenance program must run at a specific time. For ordinary automatic storage cleanup, Storage Sense is easier to manage because you can review its cleanup categories and retention settings in one place. See the Windows storage guide.

Create a Disk Cleanup profile

If your Windows build provides Disk Cleanup and you need a scheduled run, open Command Prompt and run cleanmgr.exe /sageset:42. Select only categories you have reviewed. Leave personal downloads, the Recycle Bin and rollback files out of unattended cleanup unless you have deliberately accepted their removal. Microsoft documents the cleanup profile switches. The matching /sagerun:42 argument applies the saved choices.

Create and test the scheduled task

  1. Open Task Scheduler > Create Basic Task. Give it a name you can recognize later, such as Weekly Disk Cleanup.
  2. Choose a schedule and set a time when the computer is usually on.
  3. Select Start a program. Enter cleanmgr.exe as the program and /sagerun:42 in Add arguments. Browsing to the program alone, as shown in an older screenshot, does not select the saved cleanup profile.
  4. Review the summary, select Finish, then find the task in the library. Run it on demand after reviewing the selected cleanup categories. Check Last Run Time and Last Run Result.

If the task misses its scheduled time

Open the task’s properties and check its trigger, battery and sleep conditions, and whether it requires your account to be signed in. Enable the option to run after a missed start if that fits the job. For an app you want to see on your desktop, use an At log on trigger and run it under your own session.

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.