Windows Server 2012

Disable Windows Server 2012 R2 Automatic Maintenance Using PSEXEC

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:

Sponsored Content

What is “Inside Microsoft Teams”?

“Inside Microsoft Teams” is a webcast series, now in Season 4 for IT pros hosted by Microsoft Product Manager, Stephen Rose. Stephen & his guests comprised of customers, partners, and real-world experts share best practices of planning, deploying, adopting, managing, and securing Teams. You can watch any episode at your convenience, find resources, blogs, reviews of accessories certified for Teams, bonus clips, and information regarding upcoming live broadcasts. Our next episode, “Polaris Inc., and Microsoft Teams- Reinventing how we work and play” will be airing on Oct. 28th from 10-11am PST.

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)

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:

​ psexec \%computername% -s schtasks /change /tn "MicrosoftWindowsTaskSchedulerMaintenance Configurator" /disable

(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)

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

 

Related Topics:

BECOME A PETRI MEMBER:

Don't have a login but want to join the conversation? Sign up for a Petri Account

Register
Comments (4)

4 responses to “Disable Windows Server 2012 R2 Automatic Maintenance Using PSEXEC”

  1. I am curious to know if disabling this causes any other issues. I would
    like to disable this feature on a production machine that suddenly will
    bog down in the middle of a work day. I have this Automatic Maintenance
    setup to run at 2am but it will suddenly start in the middle of the
    afternoon sometimes for some reason. Thanks in advance!

  2. The command line should look like this:

    psexec \%computername% -s schtasks /change /tn “MicrosoftWindowsTaskSchedulerMaintenance Configurator” /disable
    (the text box in your example has eaten the backslashes, hope it will not happen to this post also :-)

Leave a Reply

External Sharing and Guest User Access in Microsoft 365 and Teams

This eBook will dive into policy considerations you need to make when creating and managing guest user access to your Teams network, as well as the different layers of guest access and the common challenges that accompany a more complicated Microsoft 365 infrastructure.

You will learn:

  • Who should be allowed to be invited as a guest?
  • What type of guests should be able to access files in SharePoint and OneDrive?
  • How should guests be offboarded?
  • How should you determine who has access to sensitive information in your environment?

Sponsored by: