Jump to content
bmiller

Internal Monitor for Failed Scheduled Tasks

Recommended Posts

Hey everyone,

I have been tasks with creating an internal monitor to search for a failed scheduled task. I started the configuration and I am just  not sure of the text in the Identity Field or Additional Conditions to return a result if the scheduled tasks fails. I have attached a screenshot of the config screen, the result field is the TaskID. How do I have the monitor trigger a response if the mentioned tasks doesn't run?

 

I really appreciate all of your help, new to ConnectWise and trying to make the most of the system.

image.thumb.png.61d436ed5280da90204879dd69e0f0e6.png

Share this post


Link to post
Share on other sites

I don't see anything in that table that would indicate if a task was successful or not. The table appears only to list tasks for reference, but it doesn't record the results of the task.  For that it appears that you would need to use a remote monitor.

You could try something like: 

"%WINDIR%\system32\schtasks.exe" /query /tn "Adobe Acrobat Update Task" /v /fo LIST | find "Last Result:"

Or something using PowerShell, although it can be tricky to call correctly as a remote monitor.

Share this post


Link to post
Share on other sites
On 1/7/2019 at 1:00 AM, DarrenWhite99 said:

I don't see anything in that table that would indicate if a task was successful or not. The table appears only to list tasks for reference, but it doesn't record the results of the task.  For that it appears that you would need to use a remote monitor.

You could try something like: 


"%WINDIR%\system32\schtasks.exe" /query /tn "Adobe Acrobat Update Task" /v /fo LIST | find "Last Result:"

Or something using PowerShell, although it can be tricky to call correctly as a remote monitor.

Tried this in a remote monitor, but the result suggests the pipe is an invalid argument. Very strange, as running that command directly on the server returns the result without issue. Any idea why that would happen?

result.JPG

Share this post


Link to post
Share on other sites
On 9/4/2019 at 3:52 AM, kkevgreen said:

Tried this in a remote monitor, but the result suggests the pipe is an invalid argument. Very strange, as running that command directly on the server returns the result without issue. Any idea why that would happen?

result.JPG

Make sure the Pipe character is really a | character. 

Actually, I suspect what is happening is that schtasks is being called directly, not as a parameter to cmd.exe.  The shell is what splits commands and redirects input/output on the pipe.

Try this instead: 

cmd.exe /c "schtasks /query /tn "Adobe Acrobat Update Task" /v /fo LIST | find "Last Result:""

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...