Studio Server Workflow - Run Application Activity
VertiGIS Studio Workflow: Version 5.38.1
Workflow type: Server
Activity: Run Application
Date: 2024-04-18
What applications can be run using the Run Application activity? We have tried a number of applications but none appear to run on the server, would applications run in this way show up in the windows tasklist?
Is it possible to run a batch file or open a browser window using this activity?
Does the file name input require a full path to the executable?
Will Run Application run something that is in the path variable?
If applications like “run”, “start”, “cmd” work is the arguments input a string or something else?
We have been unable to verify that any program has actually launched on the server using the Run Application Activity from a server workflow. Wait for result is set to false.
-
Hi Tyson,
I'm Gareth from the VertiGIS North America presales team. Thank you for reaching out. These are excellent questions.
I'd like to provide some context and resources here: the Run Application activity is designed to execute an application on the Workflow Server while also passing it any necessary string arguments.
Our goal is to solve this use case: A workflow author needs the ability to run an executable on the server, like PowerShell, cmd, or a batch file. This enables the execution of a custom business process not supported by standard Workflow activities.Note that this differs from the default client-side execution of a Workflow in the users' browser. The Run Application activity only exists in Server-side Workflows and all execution happens on the server. Note also that there is no Run Application activity in the Workflow SaaS environment.
Keep in mind for this activity to function:
- The application you want to run must be installed on the server.
- It should not require elevated permissions.
- The application pool operating VertiGIS Studio Workflow must have the rights to execute your chosen application.
- This same application pool should also have access to any necessary files or resources.
For security reasons, the 'File Path' input specifying the executable must be a literal value, not an expression.
With that in mind, let's address your questions:
What applications can be run using the Run Application activity?
You can run any application that meets the conditions outlined above.
If we run applications this way, would they appear in the windows tasklist?
Yes, applications run using this activity should appear in the Windows task list. However, they will only be visible if you have the necessary permissions to see them, as these processes run under the user account of the Workflow application pool. This account may differ from the one you're signed in with on the Windows Server.
Personally, I find the built-in Task Manager in Windows to be limited. I recommend using the Process Explorer tool, which provides a more detailed view of all current processes on a Windows system, including their handles and threads.
Can we use this activity to run a batch file or open a browser window?
Yes, you can run a batch file as long as it doesn't require elevated permissions.
However, opening a browser window is not something you would typically want to do. Again, we are running as the Workflow Application Pool user and not the client-side user that is interacting with the viewer.
For scenarios where you want to pass a dynamic URL back to the user, you might choose to use a client workflow that runs a subworkflow to execute a server-side workflow that returns the result of some business logic there that contains a URL. You could then, back in that client-side workflow, use a system.open-url command to open that URL in the user's browser.Does the file name input necessitate a full path to the executable?
Yes, you should provide the full path to the executable in the 'File Path' input.
Will the Run Application execute something that is within the path variable?
Yes, the Workflow Server is aware of the users PATH variable. Note that this is run under the application pool user, so typically there isn't going to be much in the user's PATH. I would suggest rather than relying on this PATH variable to use hard-coded paths defined in your Workflow. While yes, you could choose to hardcode some detail into the user PATH, there is not much value in doing that there versus building all of your logic and context into the workflow.
For applications like “run”, “start”, “cmd”, is the arguments input a string or something else?
Yes, the 'Arguments' input is a string and can be used to pass command line arguments to the application. Arguments should be provided as a single string, separated by spaces. If an argument contains spaces, it should be enclosed in quotes.
The 'Wait For Result' argument, which defaults to True, is also important. It determines whether the activity waits for the process to exit before proceeding. If set to true, the activity waits and returns the exit code, standard output, and standard error of the application. If set to false, the activity starts the process and moves on to the next activity without waiting for the process to exit.
I hope this clarifies your questions, and I'm available for further assistance if needed!
2
Please sign in to leave a comment.
Comments
1 comment