7e4a35ad7e
We intend to expand the nightly E2E test to cover multiple distros and platforms. Change the naming structure for "Linux client" to the more precise "Ubuntu Bionic", and "Windows" to "Windows 2016" to make it easier to add new targets without additional refactoring.
31 lines
906 B
PowerShell
Executable file
31 lines
906 B
PowerShell
Executable file
$RunningAsAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
|
|
if (!$RunningAsAdmin) {
|
|
Write-Error "Must be executed in Administrator level shell."
|
|
exit 1
|
|
}
|
|
|
|
$service = Get-WmiObject Win32_Service -Filter 'Name="wuauserv"'
|
|
|
|
if (!$service) {
|
|
Write-Error "Failed to retrieve the wauserv service"
|
|
exit 1
|
|
}
|
|
|
|
if ($service.StartMode -ne "Disabled") {
|
|
$result = $service.ChangeStartMode("Disabled").ReturnValue
|
|
if($result) {
|
|
Write-Error "Failed to disable the 'wuauserv' service. The return value was $result."
|
|
exit 1
|
|
}
|
|
}
|
|
|
|
if ($service.State -eq "Running") {
|
|
$result = $service.StopService().ReturnValue
|
|
if ($result) {
|
|
Write-Error "Failed to stop the 'wuauserv' service. The return value was $result."
|
|
exit 1
|
|
}
|
|
}
|
|
|
|
Write-Output "Automatic Windows Updates disabled."
|