[Windows] Unify services handling (#8871)

* [Windows] Unify services handling

* Fix Set-Service usage
This commit is contained in:
Vasilii Polikarpov
2023-11-23 18:08:20 +01:00
committed by GitHub
parent 6efbc46fc7
commit 79c347765a
8 changed files with 21 additions and 102 deletions
@@ -12,9 +12,10 @@ Install-Binary `
Write-Host "Adding the firewall rule for Google update blocking..."
New-NetFirewallRule -DisplayName "BlockGoogleUpdate" -Direction Outbound -Action Block -Program "C:\Program Files (x86)\Google\Update\GoogleUpdate.exe"
$GoogleSvcs = ('gupdate','gupdatem')
$GoogleSvcs | Stop-SvcWithErrHandling -StopOnError
$GoogleSvcs | Set-SvcWithErrHandling -Arguments @{StartupType = "Disabled"}
$googleServices = @('gupdate', 'gupdatem') | Get-Service
Stop-Service $googleServices
$googleServices.WaitForStatus('Stopped', "00:01:00")
$googleServices | Set-Service -StartupType Disabled
$regGoogleUpdatePath = "HKLM:\SOFTWARE\Policies\Google\Update"
$regGoogleUpdateChrome = "HKLM:\SOFTWARE\Policies\Google\Chrome"