Jump to content

Recommended Posts

Hi Everyone,

I am fairly new to the community so if I'm posting in the wrong section please forgive me. We are having an issue with running scripts on our endpoints that seems to come and go. Sometimes a script that works perfectly fine will fail to run or time out. We have checked the running scripts in the system dashboard and at most we have 25 running at any time. In the screenshot I posted below we will notice the status for the invoke script step will stop at retrieving or retrieved and will sit there for a few hours before failing. We have submitted a support case but they have been less than helpful. We are currently cloud hosted on the latest version which is 200.342. Any guidance would be much appreciated. Also to note this particular script downloads a few files then executes some batch commands as an admin. This script has been tested and has worked before. 



Link to post
Share on other sites

In my experience scripts 'hanging' is pretty much always an issue with the agent not checking in (but not always). Are you able to run two scripts at once? I.e is this an isolated script?

If you can try writing a second, watchdog script,to debug this. Run your script and the watchdog script at the same time on the agent. In the main script set an EDF to something like 'mainscriptrunning'. The last line of the main script should clear the EDF.

In the watchdog add a command 'IF SQL Data Check' with the following query 

select count(*) from runningscripts where computerid=%computerid% and scriptid=12345

where 12345 is the scriptid of the main script and do a goto when the result is 0, meaning no script running.  The goto should jump to a section which handles the next check. Next line:

sleep 60

copy/paste those 2 lines a few times to reflect how long your script would normally run plus a few minutes. so, your watchdog will run for X minutes. If at any moment it finds that the main script is not running, it jumps to the bottom part, the checks.

If you get to the end of X checks and the main script is still running then generate a ticket so you can jump in and investigate. If you get to the bottom and the main script is not running, check the contents of the EDF. If its blank, all is ok. Otherwise investigate.

The watchdog serves a double use of telling you that the agent is still online and is running the watchdog script. IF the watchdog also stops execution, you have a checkin issue and the agent is going offline.  It also tells you if the main script is doing something abnormal. You could write something like 'STEP 1', 'STEP 2', etc into the EDF and have the watchdog report this into its log. By doing this, you are getting two scripts to interact and providing more information as to what is failing and where.

If your main script 'hangs', the watchdog should provide you with better evidence to supply to support. 


Honestly, my money is on the agent going offline. Many things can cause that. Machines go into suspense, dsl lines drop, AVs do weird stuff, users reboot, machines crash and reboot at inopportune moments.

Edited by imurphy
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.

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...