diff --git a/windows/win_scheduled_task.ps1 b/windows/win_scheduled_task.ps1 index 85b54c89d05..5777d198cc8 100644 --- a/windows/win_scheduled_task.ps1 +++ b/windows/win_scheduled_task.ps1 @@ -94,7 +94,7 @@ try { if ($measure.count -eq 1 ) { $exists = $true } - elseif ($measure.count -eq 0 -and $state -eq "absent" ){ + elseif ( ($measure.count -eq 0) -and ($state -eq "absent") ){ Set-Attr $result "msg" "Task does not exist" Exit-Json $result } @@ -120,13 +120,13 @@ try { } } - if ($state -eq "absent" -and $exists -eq $true) { + if ( ($state -eq "absent") -and ($exists -eq $true) ) { Unregister-ScheduledTask -TaskName $name -Confirm:$false $result.changed = $true Set-Attr $result "msg" "Deleted task $name" Exit-Json $result } - elseif ($state -eq "absent" -and $exists -eq $false) { + elseif ( ($state -eq "absent") -and ($exists -eq $false) ) { Set-Attr $result "msg" "Task $name does not exist" Exit-Json $result } @@ -138,14 +138,14 @@ try { $settings = New-ScheduledTaskSettingsSet } - if ($state -eq "present" -and $exists -eq $false){ + if ( ($state -eq "present") -and ($exists -eq $false) ){ $action = New-ScheduledTaskAction -Execute $execute Register-ScheduledTask -Action $action -Trigger $trigger -TaskName $name -Description $description -TaskPath $path -Settings $settings $task = Get-ScheduledTask -TaskName $name Set-Attr $result "msg" "Added new task $name" $result.changed = $true } - elseif($state -eq "present" -and $exists -eq $true) { + elseif( ($state -eq "present") -and ($exists -eq $true) ) { if ($task.Description -eq $description -and $task.TaskName -eq $name -and $task.TaskPath -eq $path -and $task.Actions.Execute -eq $execute -and $taskState -eq $enabled) { #No change in the task yet Set-Attr $result "msg" "No change in task $name"