How to use a Powershell script for a Monitor in Labtech Connectwise

You need to add the powershell script below to a bat file , as we can’t copy both the powershell.exe and the ps1 one

Create a script that has return 0 when working and return 1 for warning and 2 for failed

powershell -command "$events = get-scheduledtask | where {$_.State -ne 'Disabled'} | where {((Get-ScheduledTaskInfo $_).LastTaskResult -ne '0') -and ((Get-ScheduledTaskInfo $_).LastTaskResult -ne '267009') -and ((Get-ScheduledTaskInfo $_).LastRunTime -ge ((Get-Date).AddHours(-48)) -and ((Get-ScheduledTaskInfo $_).TaskPath -notlike '\Microsoft\*' ))} | Select TaskName"

powershell -command "$eventcounnt = ($events.TaskName).Count"

powershell -command "if ($eventcounnt) {return 1} else {return 0}"

Copy .bar file Labtech server C:\LTShare\Transfer\Montitors

Create a External EXE Check with the bat referenced with script

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...