Quantcast
Channel: Deployment Research - Johan Arwidmark
Viewing all articles
Browse latest Browse all 168

Automatic Maintenance in Windows Server 2012 R2 is EVIL!

$
0
0

OK, I don’t know who within Microsoft came up with the not-that-bright idea of enabling updates house-cleaning (which kills the CPU) in the automatic maintenance task in Windows Server 2012 R2. But if you ever wondered why the CPU is spiking on your servers about once a day, that’s why.

Background

Shorthand, there is a scheduled task enabled by default that will kill your 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.

001
TiWorker.exe spiking the 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
http://larsjoergensen.net/windows/windows-server/windows-server-2012/server-2012-automatic-maintenance-killed-san

 

Action Center

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.

image
The Automatic Maintenance window in the Action Center.

Fixing 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

image
Disabling Automatic Maintenance on my server.

image
Maintenance disabled.


More ...

Viewing all articles
Browse latest Browse all 168

Trending Articles