mirror of
https://github.com/Raphire/Win11Debloat.git
synced 2026-08-23 08:02:07 +00:00
fix: honor cancellation during changes (#700)
Co-authored-by: Jeffrey <9938813+Raphire@users.noreply.github.com>
This commit is contained in:
@@ -40,6 +40,8 @@ function Disable-TelemetryScheduledTasks {
|
||||
$tasks = Get-TelemetryScheduledTasks
|
||||
|
||||
foreach ($task in $tasks) {
|
||||
if ($script:CancelRequested) { return }
|
||||
|
||||
if ($script:Params.ContainsKey("WhatIf")) {
|
||||
Write-Host "[WhatIf] Disable Scheduled Task: $($task.Path)$($task.Name)" -ForegroundColor Cyan
|
||||
continue
|
||||
@@ -92,6 +94,8 @@ function Enable-TelemetryScheduledTasks {
|
||||
$tasks = Get-TelemetryScheduledTasks
|
||||
|
||||
foreach ($task in $tasks) {
|
||||
if ($script:CancelRequested) { return }
|
||||
|
||||
if ($script:Params.ContainsKey("WhatIf")) {
|
||||
Write-Host "[WhatIf] Enable Scheduled Task: $($task.Path)$($task.Name)" -ForegroundColor Cyan
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user