[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

View File

@@ -105,10 +105,10 @@ $servicesToDisable = @(
'gupdate'
'gupdatem'
'StorSvc'
)
$servicesToDisable | Stop-SvcWithErrHandling
$servicesToDisable | Set-SvcWithErrHandling -Arguments @{StartupType = "Disabled"}
) | Get-Service -ErrorAction SilentlyContinue
Stop-Service $servicesToDisable
$servicesToDisable.WaitForStatus('Stopped', "00:01:00")
$servicesToDisable | Set-Service -StartupType Disabled
# Disable scheduled tasks
$allTasksInTaskPath = @(