@@ -66,21 +66,21 @@ switch ($method) {
66
66
67
67
# Overall task comparison
68
68
Write-Debug " DEBUG: Scheduled task: $task "
69
-
69
+
70
70
# Fail condition
71
71
if ($null -eq $task ) {
72
72
Write-Progress - Activity " Testing Scheduled Task" - CurrentOperation " Comparison failed - Task Missing" - Completed - Id 1
73
73
return $false
74
74
}
75
75
76
76
$Test_ScriptResult = Test-ScheduledTaskScript
77
-
77
+
78
78
$Test_DescResult = ( $task.Description -eq $TaskDesc )
79
79
Write-Progress - Activity " Testing Scheduled Task" - CurrentOperation " Description Comparison finished with result: $Test_DescResult " - PercentComplete 80 - Id 1
80
80
81
81
$TestResult = ( $Test_DescResult -and $Test_ScriptResult )
82
82
Write-Progress - Activity " Testing Scheduled Task" - CurrentOperation " Validation finished with result: $TestResult " - Completed - Id 1
83
-
83
+
84
84
$TestResult
85
85
}
86
86
@@ -91,7 +91,6 @@ switch ($method) {
91
91
if (! $Test_ScriptResult ){
92
92
$Set_ScriptResult = Set-ScheduledTaskScript
93
93
Write-Progress - Activity " Setting Scheduled Task" - CurrentOperation " Enforced configured scriptblock" - PercentComplete 50 - Id 2
94
- Write-Host $Set_ScriptResult
95
94
}
96
95
$result = Invoke-ImmyCommand {
97
96
switch ($using :Trigger ) {
@@ -102,7 +101,7 @@ switch ($method) {
102
101
}
103
102
Write-Debug " DEBUG: Trigger is set to $ ( $using :Trigger ) "
104
103
Write-Debug " DEBUG: Build Trigger: $buildtrigger "
105
-
104
+
106
105
# Check if the task exists and remove it if it does
107
106
if (! [string ]::IsNullOrWhiteSpace($using :task )){
108
107
Unregister-ScheduledTask - TaskName $using :TaskName - Confirm:$false
@@ -125,4 +124,4 @@ switch ($method) {
125
124
Write-Host " INFO: Scheduled Task Results:"
126
125
return $result
127
126
}
128
- }
127
+ }
0 commit comments