Skip to content

Commit 0351171

Browse files
committed
Added check if no scheduled task
1 parent cb16c2b commit 0351171

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

jumpcloud-ADMU/Powershell/Start-Migration.ps1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1586,7 +1586,12 @@ Function Start-Migration {
15861586
$ScheduledTasks = Get-ScheduledTask | Where-Object { $_.TaskPath -notlike "*\Microsoft\Windows*" -and $_.State -ne "Disabled" -and $_.state -ne "Running" }
15871587
# Disable tasks before migration
15881588
Write-ToLog -message:("Disabling Scheduled Tasks...")
1589-
SetScheduledTask -op "disable" -scheduledTasks $ScheduledTasks
1589+
# Check if $ScheduledTasks is not null
1590+
if ($ScheduledTasks) {
1591+
SetScheduledTask -op "disable" -scheduledTasks $ScheduledTasks
1592+
} else {
1593+
Write-ToLog -message:("No Scheduled Tasks to disable")
1594+
}
15901595
}
15911596
Process {
15921597
# Start Of Console Output

0 commit comments

Comments
 (0)