I recently stumbled across and issue when the updates house-cleaning in the automatic maintenance task in Windows Server 2012 R2 spiked the CPU pretty bad. Here is some background info, and workaround for this issue.
Shorthand, there is a scheduled task, enabled by default, that basically killed our servers about once a day. The first time I run into to this was the night before a presentation, and suddenly my demo machine was extremely sluggish. When investigating the issue I quickly found that the TiWorker.exe was spiking my CPU.
After some additional research I found I was not alone on this issue. I found a post by Lars Jørgensen which nailed it:
Server 2012 Automatic Maintenance Killed Our SAN
The automatic maintenance job is visible in the Action Center, but the configuration are limited to say the least in that UI. It’s way better to go straight to the source which in Windows Server 2012 R2 is scheduled tasks. Below is a screenshot of the Action Center / Automatic Maintenance, but to disable it, jump to the next section: Fixing the problem.
Working Around the Problem
DISCLAIMER: I’m still trying to figure if disabling this task also stops the Windows update task, so please only do this on demo machines you use for presentations etc. NOT for production environments.
Anyway, since the Automatic Maintenance task is a built-in scheduled task, but if you think you can just open task scheduler as an administrator and disable it you’re wrong. As Lars pointed out in his post, you need to use the psexec utility (Sysinternals) together with schtasks.exe, and you need to run the command as SYSTEM. Use the following command:
psexec SERVERNAME -s schtasks /change /tn "Microsoft\Windows\TaskScheduler\Maintenance Configurator" /DISABLE
In my scenario, I was testing this on my Hyper-V host, so I simply skipped the SERVERNAME switch.
psexec -s schtasks /change /tn "Microsoft\Windows\TaskScheduler\Maintenance Configurator" /DISABLE
Happy Deployment / Johan