You are viewing limited content. For full access, please sign in.

Question

Question

Workflow will not execute .bat file

asked on August 28, 2023

We are using the code below to test running a batch file from workflow.  the script builds and appears to run properly, however it never executes.  We actually would like this to run on another server on the network, but simplified to the local LF server when we saw the same results with the network path to the .bat file.  We are seeing no errors or messages when running the script.

Imports System
Imports System.Diagnostics
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Data.SqlClient
Imports System.Text

Namespace WorkflowActivity.Scripting.Script3
    Public Class Script1
        Inherits ScriptClass90

        Protected Overrides Sub Execute()
            Dim process As New Process()

            Try
                ' Configure process settings
                process.StartInfo.UseShellExecute = False
                process.StartInfo.RedirectStandardOutput = True
                process.StartInfo.FileName = "C:\WO_Test\sendmaterial.bat"

                ' Start the process
                process.Start()


                ' Wait for the process to exit
                process.WaitForExit()


            Finally
                ' Make sure to dispose of the process
                process.Dispose()
            End Try
        End Sub
    End Class
End Namespace

 

0 0

Replies

replied on August 28, 2023

Glenn,

One thing to check is to verify that the service account that workflow is running under has full access to the folder that contains your bat file.

1 0
replied on August 28, 2023

Hey Cliff!  The service account for Workflow is in the admin group on the server and has full rights to the folder.

0 0
replied on August 29, 2023

Hello Glenn

I guess workflow didn't support run external applications , I tested it with try to run exe application and didn't running ,but you can use Network socket to send requests to external applications like trigger an action to run a batch file,

ie , you create external application with network socket and in workflow open socket connection between your application and workflow code to send your requests.

0 0
replied on August 29, 2023

What does the batch file do? Since Workflow is running as a service without a user session, it cannot run applications that will attempt to open a window.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.