Skip to content

Commit 7313c2f

Browse files
committed
Provisioning: Disable or delete unneeded tasks and services
Windows have lot's of tasks and services running which are slowing the performance of build machine. Also 'windows' and 'windows defender' updates need's to be "permanently" disabled. Task-number: QTQAINFRA-3182 Change-Id: I8f6b237fcdc6e38fa9a06836d349821d86c58afc (cherry picked from commit a3136bd) Reviewed-by: Tony Sarajärvi <[email protected]>
1 parent c486210 commit 7313c2f

12 files changed

+211
-0
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
. "$PSScriptRoot\helpers.ps1"
2+
3+
# This script will remove unneeded Tasks from Task Scheduler
4+
5+
# Application Experience 'Microsoft Compatibility Appraiser' - "Collects program telemetry information if opted-in to the Microsoft Customer Experience Improvement Program."
6+
DisableSchedulerTask "Application Experience\Microsoft Compatibility Appraiser"
7+
8+
# Application Experience 'ProgramDataUpdater' - "Collects program telemetry information if opted-in to the Microsoft Customer Experience Improvement Program"
9+
DisableSchedulerTask "Application Experience\ProgramDataUpdater"
10+
11+
# Autochk 'Proxy' - "This task collects and uploads autochk SQM data if opted-in to the Microsoft Customer Experience Improvement Program."
12+
DisableSchedulerTask "Autochk\Proxy"
13+
14+
# Chkdsk 'ProactiveScan' - "NTFS Volume Health Scan"
15+
DisableSchedulerTask "Chkdsk\ProactiveScan"
16+
17+
# Chkdsk 'SyspartRepair'
18+
DeleteSchedulerTask "Chkdsk\SyspartRepair"
19+
20+
# Customer Experience Improvement Program 'Consolidator' - "If the user has consented to participate in the Windows Customer Experience Improvement Program, this job collects and sends usage data to Microsoft."
21+
DisableSchedulerTask "Customer Experience Improvement Program\Consolidator"
22+
23+
# Customer Experience Improvement Program 'sbCeip' - "The USB CEIP (Customer Experience Improvement Program) task collects Universal Serial Bus related statistics and information about your machine and sends it to the Windows Device Connectivity engineering group at Microsoft. The information received is used to help improve the reliability, stability, and overall functionality of USB in Windows. If the user has not consented to participate in Windows CEIP, this task does not do anything."
24+
DisableSchedulerTask "Customer Experience Improvement Program\UsbCeip"
25+
26+
# Device Information 'Device'
27+
DisableSchedulerTask "Device Information\Device"
28+
29+
# Diagnosis 'Scheduled' - "The Windows Scheduled Maintenance Task performs periodic maintenance of the computer system by fixing problems automatically or reporting them through Security and Maintenance."
30+
DisableSchedulerTask "Diagnosis\Scheduled"
31+
32+
# DiskDiagnostic 'Microsoft-Windows-DiskDiagnosticDataCollector' - "The Windows Disk Diagnostic reports general disk and system information to Microsoft for users participating in the Customer Experience Program."
33+
DisableSchedulerTask "DiskDiagnostic\Microsoft-Windows-DiskDiagnosticDataCollector"
34+
35+
# ExploitGuard 'ExploitGuard MDM policy Refresh' - "Task for applying changes to the machine's Exploit Protection settings."
36+
DisableSchedulerTask "ExploitGuard\ExploitGuard MDM policy Refresh"
37+
38+
# Feedback/Siuf 'DmClient'
39+
DisableSchedulerTask "Feedback\Siuf\DmClient"
40+
41+
# Feedback/Siuf 'DmClient'OnScenarioDownload'
42+
DisableSchedulerTask "Feedback\Siuf\DmClientOnScenarioDownload"
43+
44+
# File Classification Infrastructure 'Property Definition Sync'
45+
DisableSchedulerTask "File Classification Infrastructure\Property Definition Sync"
46+
47+
# InstallService 'ScanForUpdates'
48+
DisableSchedulerTask "InstallService\ScanForUpdates"
49+
50+
# InstallService 'ScanForUpdatesAsUser'
51+
DisableSchedulerTask "InstallService\ScanForUpdatesAsUser"
52+
53+
# LanguageComponentsInstaller 'Installation' - "Install language components that match the user's language list."
54+
DisableSchedulerTask "LanguageComponentsInstaller\Installation"
55+
56+
# LanguageComponentsInstaller 'ReconcileLanguageResources' - "Install language components that match the user's language list."
57+
DisableSchedulerTask "LanguageComponentsInstaller\ReconcileLanguageResources"
58+
59+
# PI 'Secure-Boot-Update' - "This task updates the Secure Boot variables."
60+
DisableSchedulerTask "PI\Secure-Boot-Update"
61+
62+
# PI 'Sqm-Tasks' - "This task gathers information about the Trusted Platform Module (TPM), Secure Boot, and Measured Boot."
63+
DisableSchedulerTask "PI\Sqm-Tasks"
64+
65+
# Power Efficiency Diagnotics 'AnalyzeSystem' - "This task analyzes the system looking for conditions that may cause high energy use."
66+
DisableSchedulerTask "PushToInstall\Registration"
67+
68+
# Servicing 'StartComponentCleanup'
69+
DisableSchedulerTask "Servicing\StartComponentCleanup"
70+
71+
# SettingSync 'BackgroundUploadTask'
72+
DeleteSchedulerTask "SettingSync\BackgroundUploadTask"
73+
74+
# SoftwareProtectionPlatform 'SvcRestartTask' - "This task restarts the Software Protection Platform service at the specified time"
75+
DeleteSchedulerTask "SoftwareProtectionPlatform\SvcRestartTask"
76+
77+
# SoftwareProtectionPlatform 'SvcRestartTaskLogon' - "This task restarts the Software Protection Platform service at the specified time"
78+
DisableSchedulerTask "SoftwareProtectionPlatform\SvcRestartTaskLogon"
79+
80+
# SoftwareProtectionPlatform 'SvcRestartTaskNetwork' - "This task restarts the Software Protection Platform service when a new network is detected"
81+
DisableSchedulerTask "SoftwareProtectionPlatform\SvcRestartTaskNetwork"
82+
83+
# UNP 'RunUpdateNotificationMgr'
84+
DeleteSchedulerTask "UNP\RunUpdateNotificationMgr"
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Disable UpdateOrchestrator
2+
3+
$name = "UpdateOrchestrator"
4+
$path = "C:\Windows\System32\Tasks\Microsoft\Windows\$name"
5+
6+
takeown /F $path /A /R
7+
icacls $path /grant Administrators:F /T
8+
SCHTASKS /Change /TN "Microsoft\Windows\$name\Reboot" /DISABLE
9+
del "$path\Combined Scan Download Install"
10+
del "$path\Maintenance Install"
11+
del "$path\Reboot"
12+
del "$path\Policy Install"
13+
del "$path\Refresh Settings"
14+
del "$path\Resume On Boot"
15+
del "$path\USO_UxBroker_Display"
16+
del "$path\USO_UxBroker_ReadyToReboot"
17+
18+
# Disable Update orchestrator service
19+
reg.exe ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\UsoSvc" /V Start /T REG_dWORD /D 4 /F

coin/provisioning/common/windows/disable-windefender.ps1

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,36 @@
1+
###########################################################################
2+
##
3+
## Copyright (C) 2019 The Qt Company Ltd.
4+
## Contact: http://www.qt.io/licensing/
5+
##
6+
## This file is part of the provisioning scripts of the Qt Toolkit.
7+
##
8+
## $QT_BEGIN_LICENSE:LGPL21$
9+
## Commercial License Usage
10+
## Licensees holding valid commercial Qt licenses may use this file in
11+
## accordance with the commercial license agreement provided with the
12+
## Software or, alternatively, in accordance with the terms contained in
13+
## a written agreement between you and The Qt Company. For licensing terms
14+
## and conditions see http://www.qt.io/terms-conditions. For further
15+
## information use the contact form at http://www.qt.io/contact-us.
16+
##
17+
## GNU Lesser General Public License Usage
18+
## Alternatively, this file may be used under the terms of the GNU Lesser
19+
## General Public License version 2.1 or version 3 as published by the Free
20+
## Software Foundation and appearing in the file LICENSE.LGPLv21 and
21+
## LICENSE.LGPLv3 included in the packaging of this file. Please review the
22+
## following information to ensure the GNU Lesser General Public License
23+
## requirements will be met: https://www.gnu.org/licenses/lgpl.html and
24+
## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25+
##
26+
## As a special exception, The Qt Company gives you certain additional
27+
## rights. These rights are described in The Qt Company LGPL Exception
28+
## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29+
##
30+
## $QT_END_LICENSE$
31+
##
32+
#############################################################################
33+
134
# Turning off win defender.
235
#
336
# If disabled manually, windows will automatically enable it after
@@ -6,3 +39,21 @@
639
. "$PSScriptRoot\helpers.ps1"
740

841
Run-Executable "reg.exe" "ADD `"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender`" /V DisableAntiSpyware /T REG_dWORD /D 1 /F"
42+
43+
# 'Windows Defender Cache Maintenance' - "Periodic maintenance task."
44+
DisableSchedulerTask "Windows Defender\Windows Defender Cache Maintenance"
45+
46+
# 'Windows Defender Cleanup' - "Periodic cleanup task."
47+
DisableSchedulerTask "Windows Defender\Windows Defender Cleanup"
48+
49+
# 'Windows Defender Scheduled Scan' - "Periodic scan task."
50+
DisableSchedulerTask "Windows Defender\Windows Defender Scheduled Scan"
51+
52+
# 'Windows Defender Verification' - "Periodic verification task."
53+
DisableSchedulerTask "Windows Defender\Windows Defender Verification"
54+
55+
# Disable 'QueueReporting' - "Windows Error Reporting task to process queued reports."
56+
DisableSchedulerTask "Windows Error Reporting\QueueReporting"
57+
58+
# Disable WindowsUpdate from Task Scheduler
59+
DisableSchedulerTask "WindowsUpdate\Scheduled Start"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Disable Windows File Protection
2+
# Windows File Protection feature in Microsoft Windows prevents programs from replacing critical Windows system files.
3+
4+
reg.exe ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /V SFCDisable /T REG_dWORD /D 0xffffff9d /F
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Disable Windows Module Installer (Trusted Installer).
2+
# Trusted Installe enables installation, modification, and removal of Windows updates and optional components.
3+
# If this service is disabled, install or uninstall of Windows updates might fail for this computer.
4+
sc.exe config TrustedInstaller start=disabled
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# The Windows as a Service (WaaS) Update Assessment Platform provides information on a device's Windows updates.
2+
3+
$limit = (Get-Date).AddMinutes(20)
4+
$path = "C:\Windows\System32\WaaSAssessment.dll"
5+
6+
DO {
7+
takeown /F $path
8+
icacls $path /grant Administrators:f
9+
Write-host "Deleting $path"
10+
11+
Try {
12+
del $path
13+
}
14+
Catch [System.UnauthorizedAccessException] {
15+
Write-host "Access to the path '$path' is denied."
16+
Continue
17+
}
18+
19+
if ((Get-Date) -gt $limit) {
20+
exit 1
21+
}
22+
23+
}while (Test-Path -Path "$path")

coin/provisioning/common/windows/helpers.ps1

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,23 @@ function Remove {
222222
}
223223
}
224224
}
225+
226+
function DisableSchedulerTask {
227+
228+
Param (
229+
[string]$Task = $(BadParam("a task"))
230+
)
231+
232+
Write-Host "Disabling $Task from Task Scheduler"
233+
SCHTASKS /Change /TN "Microsoft\Windows\$Task" /DISABLE
234+
}
235+
236+
function DeleteSchedulerTask {
237+
238+
Param (
239+
[string]$Task = $(BadParam("a task"))
240+
)
241+
242+
Write-Host "Disabling $Task from Task Scheduler"
243+
SCHTASKS /DELETE /TN "Microsoft\Windows\$Task" /F
244+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
. "$PSScriptRoot\..\common\windows\disable-windows-file-protector.ps1"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
. "$PSScriptRoot\..\common\windows\disable-schedule-tasks.ps1"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
. "$PSScriptRoot\..\common\windows\disable-update-orchestrator.ps1"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
. "$PSScriptRoot\..\common\windows\disable-windows-module-installer.ps1"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
. "$PSScriptRoot\..\common\windows\disable-windows-update-assessment.ps1"
2+

0 commit comments

Comments
 (0)