Disable Windows Server 2012 R2 Automatic Maintenance Using PSEXEC

Posted on August 7, 2014 by Daniel Petri in Windows Server 2012 with 0 Comments

This is one of those articles that I wrote out of frustration: This time the cause of my frustration is the automatic maintenance feature in Windows Server 2012 R2. I’ve been on a training tour in Australia for the last two weeks, visiting various customers and delivering customized training for them. During all of my sessions, I used several virtual machines running Windows Server 2012 R2 that I used for demonstration purposes. These VMs were booted from a pre-configured snapshot state. I would then use them for a couple of days, and when done I would restore them to the snapshot state.

During my presentations and demos I discovered that sometimes my VMs would exhibit a nasty performance lag: Nothing worked, CPU usage was as high as 100 percent without me doing anything, and apps and tools that I needed — even simple ones such as Notepad — would take forever to start. One of my VMs ran SQL Server, two others were domain controllers, and nothing seemed to work.

After some investigation I found that it wasn’t my laptop, which is a powerful Lenovo T430S with 16GB or RAM and two fast SSD disks and an Intel i7 CPU. It also wasn’t my hypervisor software, and it wasn’t the food I ate for lunch that day. It was something else that is nasty and evil: Automatic Maintenance.

Windows Server 2012 R2 Automatic Maintenance

The only hint, besides the spiking CPU and awful performance, is the tray icon seen here:

Windows Server 2012 R2 automatic maintenance tray icon

The Windows Server 2012 R2 automatic maintenance tray icon.
(Image: Daniel Petri)

Looking at Task Manager’s performance tab, you can’t see the CPU spike, it’s constantly at 100%:

Windows Server 2012 R2 automatic maintenance CPU usage

Windows Server 2012 R2 automatic maintenance CPU usage.
(Image: Daniel Petri)

Digging deeper you see that it is a process called “TiWorker.exe” that’s responsible for the CPU hell:

TiWorker.exe CPU usage

Viewing TiWorker.exe CPU usage in Windows Task Manager. (Image: Daniel Petri)

This is an automated scheduled task that comes pre-configured in Windows Server 2012 R2, both Core and GUI versions. It runs each day at 2:00 AM by default. Judging by the text provided in the UI, it should only run when “you’re not using your computer.”

The problem is that a server is seldom used by a user, unlike a workstation computer. A server does stuff in the background, runs VMs (if it hosts the Hyper-V role, for example), hosts shares, runs anti-virus software and much more. They all just stop responding until this process is done.

You can manually stop the maintenance process like this:

Attempting to stop the Windows Server 2012 automatic maintenance program manually

Attempting to stop the Windows Server 2012 automatic maintenance program manually. (Image: Daniel Petri)

Selecting 'Stop Maintenance' in the Windows Server 2012 R2 Action Center

Selecting ‘Stop Maintenance’ in the Windows Server 2012 R2 Action Center. (Image: Daniel Petri)

You think that by pressing the “Changing maintenance settings” you can make it go away:

Selecting 'Change maintenance settings' in the Windows Server 2012 R2 Action Center.

Selecting ‘Change maintenance settings’ in the Windows Server 2012 R2 Action Center. (Image: Daniel Petri)

Sponsored

But no, there’s only a limited set of options you can change, and disabling it is not one of them. It will always come back to haunt you!

Automatic maintenance settings in the Windows Server 2012 R2 Action Center.

Automatic maintenance settings in the Windows Server 2012 R2 Action Center. (Image: Daniel Petri)

If you go to Task Scheduler in Administrative Tools, you can see the task running:

The manual maintenance task running in Task Scheduler.

The manual maintenance task running in Task Scheduler. (Image: Daniel Petri)

In reality, the “Maintenance Configurator” task is the one responsible for the task, but if you try to disable it, you cannot:

Attempting to disable the maintenance configurator in Windows Server 2012 R2.

Attempting to disable the maintenance configurator in Windows Server 2012 R2. (Image: Daniel Petri)

Denied! Attempting to disable the maintenance configurator in Windows Server 2012 R2.

Denied! Attempting to disable the maintenance configurator in Windows Server 2012 R2. (Image: Daniel Petri)

Disabling Windows Server 2012 R2 Automatic Maintenance with PSEXEC

After digging around and with help from my friend Kurt Teo from Melbourne, the solution I found was to disable it using the PSEXEC tool and this command.

NOTE: Please be cautious and use this procedure at your own risk: I did not test this on production servers, and stopping the task scheduler may also stop automatic Windows updates or other tasks, so please test before applying to production.

This is the ONLY known way to stop it from ever running:

After downloading PSEXEC, open a Command Prompt with elevated permissions, and type:

(Use the path the where PSEXEC is located, or add it to your system path.)

windows server 2012 disable automatic maintenance

Disabling Windows Server 2012 R2 automatic maintenance using PSEXEC. (Image: Daniel Petri)

Confirmation that the maintenance configurator in Windows Server 2012 R2 has been disabled.

Confirmation that the maintenance configurator in Windows Server 2012 R2 has been disabled. (Image: Daniel Petri)

Sponsored

If you’ve used PSEXEC to troubleshoot any other Windows Server 2012 frustrations, please add a comment to this post and share your experiences.

 

Sponsored

Tagged with