mirror of
git://code.qt.io/qt/qt5.git
synced 2026-02-01 19:36:04 +08:00
Provisioning: Fix disabling windows updates
On some machines the updates were already disabled, which lead to the call to disable the service failing. Now we just move on without error. Change-Id: Ia48f7164c23dfe24e24548558d582cdc0190b7e3 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io> Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
This commit is contained in:
committed by
Frederik Gladhorn
parent
b86b3a757b
commit
99595f44f1
@@ -33,5 +33,22 @@
|
||||
|
||||
# This script disables the automatic Windows updates
|
||||
|
||||
stop-service wuauserv
|
||||
set-service wuauserv <EFBFBD>startup disabled
|
||||
$service = get-service wuauserv
|
||||
if (-not $service) {
|
||||
Write-Host "Windows Update service not found."
|
||||
exit 0
|
||||
}
|
||||
|
||||
if ($service.Status -eq "Stopped") {
|
||||
Write-Host "Windows Update service already stopped."
|
||||
} else {
|
||||
Write-Host "Stopping Windows Update service."
|
||||
stop-service wuauserv
|
||||
}
|
||||
|
||||
$startup = Get-WmiObject Win32_Service | Where-Object {$_.Name -eq "wuauserv"} | Select -ExpandProperty "StartMode"
|
||||
if ($startup -ne "Disabled") {
|
||||
set-service wuauserv -startup disabled
|
||||
} else {
|
||||
Write-Host "Windows Update service startup already disabled."
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user