Skip to content

Commit 2981f0f

Browse files
Update Set-ScheduledTask.ps1 with latest from Immy
1 parent dfc371e commit 2981f0f

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Function/Set-ScheduledTask.ps1

+5-6
Original file line numberDiff line numberDiff line change
@@ -66,21 +66,21 @@ switch ($method) {
6666

6767
#Overall task comparison
6868
Write-Debug "DEBUG: Scheduled task: $task"
69-
69+
7070
#Fail condition
7171
if ($null -eq $task) {
7272
Write-Progress -Activity "Testing Scheduled Task" -CurrentOperation "Comparison failed - Task Missing" -Completed -Id 1
7373
return $false
7474
}
7575

7676
$Test_ScriptResult = Test-ScheduledTaskScript
77-
77+
7878
$Test_DescResult = ( $task.Description -eq $TaskDesc )
7979
Write-Progress -Activity "Testing Scheduled Task" -CurrentOperation "Description Comparison finished with result: $Test_DescResult" -PercentComplete 80 -Id 1
8080

8181
$TestResult = ( $Test_DescResult -and $Test_ScriptResult )
8282
Write-Progress -Activity "Testing Scheduled Task" -CurrentOperation "Validation finished with result: $TestResult" -Completed -Id 1
83-
83+
8484
$TestResult
8585
}
8686

@@ -91,7 +91,6 @@ switch ($method) {
9191
if(!$Test_ScriptResult){
9292
$Set_ScriptResult = Set-ScheduledTaskScript
9393
Write-Progress -Activity "Setting Scheduled Task" -CurrentOperation "Enforced configured scriptblock" -PercentComplete 50 -Id 2
94-
Write-Host $Set_ScriptResult
9594
}
9695
$result = Invoke-ImmyCommand {
9796
switch ($using:Trigger) {
@@ -102,7 +101,7 @@ switch ($method) {
102101
}
103102
Write-Debug "DEBUG: Trigger is set to $($using:Trigger)"
104103
Write-Debug "DEBUG: Build Trigger: $buildtrigger"
105-
104+
106105
# Check if the task exists and remove it if it does
107106
if (![string]::IsNullOrWhiteSpace($using:task)){
108107
Unregister-ScheduledTask -TaskName $using:TaskName -Confirm:$false
@@ -125,4 +124,4 @@ switch ($method) {
125124
Write-Host "INFO: Scheduled Task Results:"
126125
return $result
127126
}
128-
}
127+
}

0 commit comments

Comments
 (0)