Show order of operations with parenthesis
This commit is contained in:
parent
0d78c01d32
commit
f1e8de2f67
1 changed files with 5 additions and 5 deletions
|
@ -94,7 +94,7 @@ try {
|
||||||
if ($measure.count -eq 1 ) {
|
if ($measure.count -eq 1 ) {
|
||||||
$exists = $true
|
$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"
|
Set-Attr $result "msg" "Task does not exist"
|
||||||
Exit-Json $result
|
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
|
Unregister-ScheduledTask -TaskName $name -Confirm:$false
|
||||||
$result.changed = $true
|
$result.changed = $true
|
||||||
Set-Attr $result "msg" "Deleted task $name"
|
Set-Attr $result "msg" "Deleted task $name"
|
||||||
Exit-Json $result
|
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"
|
Set-Attr $result "msg" "Task $name does not exist"
|
||||||
Exit-Json $result
|
Exit-Json $result
|
||||||
}
|
}
|
||||||
|
@ -138,14 +138,14 @@ try {
|
||||||
$settings = New-ScheduledTaskSettingsSet
|
$settings = New-ScheduledTaskSettingsSet
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($state -eq "present" -and $exists -eq $false){
|
if ( ($state -eq "present") -and ($exists -eq $false) ){
|
||||||
$action = New-ScheduledTaskAction -Execute $execute
|
$action = New-ScheduledTaskAction -Execute $execute
|
||||||
Register-ScheduledTask -Action $action -Trigger $trigger -TaskName $name -Description $description -TaskPath $path -Settings $settings
|
Register-ScheduledTask -Action $action -Trigger $trigger -TaskName $name -Description $description -TaskPath $path -Settings $settings
|
||||||
$task = Get-ScheduledTask -TaskName $name
|
$task = Get-ScheduledTask -TaskName $name
|
||||||
Set-Attr $result "msg" "Added new task $name"
|
Set-Attr $result "msg" "Added new task $name"
|
||||||
$result.changed = $true
|
$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) {
|
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
|
#No change in the task yet
|
||||||
Set-Attr $result "msg" "No change in task $name"
|
Set-Attr $result "msg" "No change in task $name"
|
||||||
|
|
Loading…
Reference in a new issue