fix: honor cancellation during changes (#700)

Co-authored-by: Jeffrey <9938813+Raphire@users.noreply.github.com>
This commit is contained in:
Kushida
2026-07-14 22:06:40 +02:00
committed by GitHub
co-authored by Jeffrey
parent 8fa1332ff0
commit de817399e6
3 changed files with 37 additions and 81 deletions
@@ -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