Adjust services handling in Finalize-VM and helpers (#8771)

This commit is contained in:
Shamil Mubarakshin
2023-11-10 16:25:40 +01:00
committed by GitHub
parent 286fb24a63
commit 495f740eda
2 changed files with 29 additions and 42 deletions

View File

@@ -104,10 +104,8 @@ $servicesToDisable = @(
'StorSvc'
)
$servicesToDisable | ForEach-Object {
Stop-Service -Name $_
Set-Service -Name $_ -StartupType Disabled -ErrorAction Ignore
} | Out-Null
$servicesToDisable | Stop-SvcWithErrHandling
$servicesToDisable | Set-SvcWithErrHandling -Arguments @{StartupType = "Disabled"}
# Disable scheduled tasks
$allTasksInTaskPath = @(