From a3136bdbfef242339c002630f51b4bc0f5c05503 Mon Sep 17 00:00:00 2001 From: Heikki Halmet Date: Tue, 3 Sep 2019 12:46:29 +0300 Subject: Provisioning: Disable or delete unneeded tasks and services MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Tony Sarajärvi --- .../windows/disable-windows-update-medic.ps1 | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 coin/provisioning/common/windows/disable-windows-update-medic.ps1 (limited to 'coin/provisioning/common/windows/disable-windows-update-medic.ps1') diff --git a/coin/provisioning/common/windows/disable-windows-update-medic.ps1 b/coin/provisioning/common/windows/disable-windows-update-medic.ps1 new file mode 100644 index 00000000..6accbd3b --- /dev/null +++ b/coin/provisioning/common/windows/disable-windows-update-medic.ps1 @@ -0,0 +1,25 @@ +# Windows Update Medic Service (WaaSMedicSvc)'PerformRemediation' helps recover update-related services to the supported configuration. +# WaasMedicSvc keeps re-starting Windows Update, even if it disabled manually. +# Even Admin user don't have privileged to disable PerformRemediation from Task Scheduler which means that WaaSMedicSvc.dll need's to be removed from the system + +$limit = (Get-Date).AddMinutes(20) +$path = "C:\Windows\System32\WaaSMedicSvc.dll" + +DO { + takeown /F $path + icacls $path /grant Administrators:f + Write-host "Deleting $path" + + Try { + del $path + } + Catch [System.UnauthorizedAccessException] { + Write-host "Access to the path '$path' is denied." + Continue + } + + if ((Get-Date) -gt $limit) { + exit 1 + } + +}while (Test-Path -Path "$path") -- cgit v1.2.3