8

When using Server 2012 I disabled the (evil) Automatic Maintenance task using the following commands (originally found here):

psexec \\SERVERNAME -s schtasks /change /tn "\Microsoft\Windows\TaskScheduler\Maintenance Configurator" /DISABLE
psexec -s schtasks /change /tn "\Microsoft\Windows\TaskScheduler\Maintenance Configurator" /DISABLE

When I try to run this on Server 2016 those entries do not exist. I know it is somewhere because TiWorker.exe eats up a bunch of CPU doing whatever it does. Does anyone know where this setting is in Server 2016?

Shaun Bowe
  • 267
  • 1
  • 4
  • 9

4 Answers4

2

Looks like that task isn't included in Server 2016. I verified this on a fresh install. Windows appears to run the maintenance scheduled tasks individually now.

The one that runs tiworker and the one that I'm finding the most intrusive is the SilentCleanup task, which runs disk cleanup whether the disk space is low or not, counter to its description. That one can be found under the DiskCleanup folder. I think I'm going to disable this task across the board since there is no reason a server should be running automatic disk cleanup IMO.

Edit: I found a way to check what all the maintenance tasks are:

$MaintTasks = @()
foreach ($task in (Get-ScheduledTask))
{
if (($task | Export-ScheduledTask) -like “*maintenance*”) {$MaintTasks += $task}
}
$MaintTasks
1

On a fresh WS 2016 install:

Get-ScheduledTask | Where-Object -Property Description -Match "maint"

TaskPath                                       TaskName                          State     
--------                                       --------                          -----     
\Microsoft\Windows\ApplicationData\            DsSvcCleanup                      Ready     
\Microsoft\Windows\Diagnosis\                  Scheduled                         Ready     
\Microsoft\Windows\DiskCleanup\                SilentCleanup                     Ready     
\Microsoft\Windows\Windows Defender\           Windows Defender Cache Mainten... Ready

The Diagnosis task seems to be relevant. It's using a custom handler. Have you dug into that yet?

t3hcr
  • 31
  • 6
0

This will disable the Disk optimization job (Tested on a Windows Server 2016):

If ((Get-ScheduledTask -TaskName 'ScheduledDefrag').State -eq 'Ready') 
{
    Disable-ScheduledTask -TaskName 'ScheduledDefrag' -TaskPath '\Microsoft\Windows\Defrag'
}
Andreas
  • 309
  • 1
  • 5
  • 17
-1

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

psexec \%computername% -s schtasks /change /tn "MicrosoftWindowsTaskSchedulerMaintenance Configurator" /disable
wkb
  • 1