Script execution job is not working through SapphireIMS, but same is working when I execute manually. How to troubleshoot this?

Below things need to be checked:

  • 64-bit Resources: In a 64-bit machine when you execute the script manually, it will use the 64 bit resources (such as registry, program files folder, etc.,), whereas SapphireIMS agent is a 32-bit application when it launches same script, it will be using the 32 bit resource. Hence you may face some issues - In this case, the script should be written with business logic to use proper resource though it is launched from 32 bit application.

  • Working Directory: When launching script from SapphireIMS, it will not use the working directory as the path in which script is available. It will be using SapphireIMS Agent install path as working directory, whereas when trying manually, the user might have tried working directory as the patch in which script is available. It could be another reason for such failure. To switch the path, add below statement at the beginning of the script.

CD “%~dp0”

  • Prompts: SapphireIMS script execution/software deployment will work only if it is completely running in silent mode. If any popup appears when script is launched, then the it will not work as expected through SapphireIMS. This can be verified by launching script manually. Change the script logic accordingly if any popup/script waits of any user intervention.

  • %PROGRAMFILES% environment variable: When using this environment variable manually, it will properly result in C:\Program Files\ path. But SapphireIMS will launch this as 32 bit application, hence this variable will result in C:\Program Files (x86)\ and script may not work as expected. If this is the scenario, then instead of using %PROGRAMFILES% use %SYSTEMDRIVE%\Program Files\ in the script.

  • Handle script for path containing space: When launching script manually in command prompt, try to place the script in a folder which contains space and verify it. Customer script may not be handled when path contains space. SapphireIMSAgent typically installed in a path contains space (Program Files). Script should be handled in such way to work even when path contains space.

There could be another reason, for which please refer this article.

5 Likes