Launching a Task in EasyMorph Desktop from EasyMorph Server via Command Line Worker

Hello,

If we have EasyMorph Server and EasyMorph Desktop licensed in the same machine, is it possible to launch an EasyMorph Server task that in turn launches an EasyMorph Desktop task in that computer, using the Command Line Worker and the “Run Command” action? There are certain VBA actions that only work for us in EasyMorph Desktop, but we may need to launch the task remotely (via EasyMorph Server), so can this solution work?

Thanks!

Roberto

Theoretically, it may work if you manage to launch CLW from Server under a different Windows account (the one under which the VBA macro works).

You can try using the psexec Windows command to launch CLW from a Server task which, in this case, will have one action “Run program” with arguments something like (not tested):

psexec -u VBA_USER -p PASSWORD "morph-cmd.exe myproject.morph"
1 Like

Hello @dgudkov,

I installed PsExec and when launching the “Run Program” action having EasyMorph Desktop open in the Server computer, it launches the other EasyMorph project through morph-cmd.exe correctly.

However, when I launch the task from EasyMorph Server, this is the reply I get from PsExec:

These are the arguments I’m using:

C:\Tools\Sysinternals\PsExec.exe -accepteula -u (Username) -p (Password) "C:\Program Files (x86)\EasyMorph Command Line Worker\morph-cmd.exe" "C:\Users\Public\Documents\Morphs\Test Email.morph"

If I remove the Username and Password information from the Arguments, the process launches correctly even from the server, but once I add the username and password, I get error code -1073741502 from the Command Line Worker.

Do you know what could be the reason for this?

Thanks very much,

Roberto

Hello again @dgudkov,

I have also tried editing the “Security Policy Settings” and add the VBA User to the “Log on as a Service” Policy (Log on as a service (Windows 10) - Windows security | Microsoft Docs).

This allows me to run the psexec with the “-h” switch " (“If the target system is Vista or higher, has the process run with the account’s elevated token, if available”, more info: PsExec - Windows Sysinternals | Microsoft Docs):

C:\Tools\Sysinternals\PsExec.exe -accepteula -u (Username) -p (Password) -h “C:\Program Files (x86)\EasyMorph Command Line Worker\morph-cmd.exe” “C:\Users\Public\Documents\Morphs\Test Email.morph”

Again, if I run the “Run Program” action from EasyMorph Desktop in the server computer (with the actual project open and running the “Run Program” action), the Command Line Worker is executed correctly and the second project is triggered correctly.

However, if I launch it from EasyMorph Server (using the “-h” switch and having added the VBA User to “Log on as a Service” in the “Security Policy Settings”), it doesn’t work and I get this error:

image

I don’t know if I had to add the VBA User to the “Log on as a Service” Security Policy Settings, just trying possibilities…

I have also tried disabling the firewall temporarily if that could make any difference, but it didn’t.

Any ideas?

Thanks very much!

Roberto

1 Like

@dgudkov Thanks for the heart ;), I’ve done a lot of research but I am completely stuck with this one…

Do you think I should be doing the arguments differently or a different Server configuration / user permissions?

What does the error code -1073741502 from the Command Line Worker mean?

UPDATE: I have found the following information regarding this error:

Source: Batch Script - Return Code

Thanks

I don’t know. EasyMorph doesn’t generate that.

This looks like a VBA-related issue. I don’t see how EasyMorph relates to it.

Hello, it is not a VBA-related issue because this error was happening with a very simple project I was trying that had no VBA, it was just a project sending an email to myself to make sure it had been run.

The -1073741502 error is given by EasyMorph CLW when PSEXEC tries to run morph-cmd.exe as a user different from NT AUTHORITY/LOCALSERVICE.

Regards,

Roberto

EasyMorph doesn’t produce this error. It comes from Windows.

Then I guess the conclusion is that PSEXEC can’t run a task through CLW as another user when the initial task that triggered CLW was ran as NT AUTHORITY/LOCAL SERVICE (from Server), there is something that is not working… I don’t know either.

As I mentioned in a previous post, PSEXEC returns that CLW exited with a certain error (this error is returned by the command line execution):

Did you try running a simple project (e.g. generate a sequence from 1 to 10 and export into a text file) in CLW under psexec? Something that doesn’t require running VBA scripts or external apps.