0

We have Alteryx on several servers and want to be able to run jobs remotely from either command line or powershell, not through Alteryx API.

I have run alteryx flows locally from command line and powershell locally for years but now with multiple servers we have need to execute certain flows this way but to trigger from a react web app. We tried the API and it works but jobs often queue for too long and we need near realtime response and these jobs run in seconds. Our solution is to trigger outside the Alteryx API for immediate execution on a worker node with excess resources.

Our problem is that when testing the script which works well if run locally it runs all other commands fine except the execution of the alteryxenginecmd.exe program.

if I use Start-Process with passthru it generates a process but no output from the alteryx job and no errors detected. If I use Call operator & if fails saying it can;t find the workflow, so the alteryxenginecmd.exe is firing but not reading or receiving the full path of the flow to run as the parameter. but it works fine locally. I have used creds to force a sign on to clear any credential issue with no change in result.

I know Powershell has some oddities and maybe there is some tweak to how a command must be specified if the script is run from a remote server?

This is the script I want to run from remote server which does work fine in any of the 4 scenarios shown

    $rundate = (Get-Date -format 'u') -replace "-",""  -replace ":","" -replace " ","-"
    $Pgm2Run = "\<somepath>\RunScriptRemote\RunRemoteTest2 - NoDB.yxmd"
    $Bat2Run = "\\<somepath>\RunScriptRemote\RunRemoteTestJob.bat"
    $JobLogFile = "\<somepath>\RunScriptRemote\LogsJob\JobTranscript $rundate.txt"
    $ScriptLogFile = "\<somepath>\RunScriptRemote\LogsScript\RunJobTranscript $rundate.txt"
    Start-Transcript  -Path $ScriptLogFile 
    echo "  "
    echo "$rundate Start --> "
    Echo "$rundate Before Start-Process"
    #1  Start-Process -filepath "AlteryxEngineCmd.exe" -ArgumentList `"$Pgm2Run`" -RedirectStandardOutput $JobLogFile  -Wait -PassThru  
    #2  Start-Process -filepath $Bat2Run   -RedirectStandardOutput $JobLogFile  -Wait -PassThru 
    #3  & AlteryxEngineCmd.exe "$Pgm2Run"
    AlteryxEngineCmd.exe "$Pgm2Run"
    echo "$rundate After Start-Process"
    echo "$rundate End --> " 
    Stop-Transcript 

This command run on Server1 to execute the script above on server2

    Invoke-Command -ComputerName server2 -FilePath "\\<somepath>\RunScriptRemote\RunAlteryxAndLogIt.ps1"

And this is the result:

20200831-094309Z Before Start-Process
AlteryxEngineCmd.exe Version 2019.4.8.22007 © Alteryx, Inc. - All Rights Reserved.
Started running \\<somepath>\RunRemoteTest2 - NoDB.yxmd
Error - Alteryx Engine: Can't read the file "
Invoke-Command -ComputerName server2 -FilePath "\\<somepath>\RunScriptRemote\RunRemoteTest2 - NoDB.yxmd"
Finished in 0.020 seconds with 1 error
20200831-094309Z After Start-Process

I am not sure it is a powershell thing, it may well be an Alteryx thing because the issue seems to be executing that one exe properly. the script triggers properly from remote server and I tested other commands and all worked, I just can't seem to get the one executing this exe to work when run remotely though it works fine locally when same script is run locally. its like a barrier betweek a script running another script.

Any powershell experts familiar with running exe's remotely from another server?

Trees
  • 1
  • 1
  • Could you please fix the formatting and format code as code? – Patrick Mcvay Aug 31 '20 at 18:37
  • If you aren't supplying alternate credentials, does that mean you are using CredSSP? By default you can't double hop meaning you can't invoke from A to B and have B connect to C without CredSSP, alternate credentials, etc. Can you confirm you're using CredSSP? – Doug Maurer Aug 31 '20 at 19:54
  • I am within our firewall and using same credential, service account, on each system. I have run it without passing creds and by passing creds using -Credential parameter which has a popup for the password. same result in each case. – Trees Sep 02 '20 at 18:32
  • It runs the script, executes the other commands in the script and actually executes the start-process and call commands, tried both. The problem is the behavior is different when run from a remote system vs run local (signed into that system). If I am signed into the server I want to run the script on and I execute the script it works fine. – Trees Sep 02 '20 at 18:42
  • When I sign into the other server and use invoke-command to trigger the script remotely on that first server the start-command and the call operator do seem to kick off the alteryxenginecmd.exe but it seems to terminate immediately. I think it is as if the argument fed to the program is not passing. Start-Process -filepath "AlteryxEngineCmd.exe" -ArgumentList `"$Pgm2Run`" $Pgm2Run contains the full path to the alteryx flow I want AlteryxEngineCmd.exe to run – Trees Sep 02 '20 at 18:42
  • Oh...to be clear not using CredSSP – Trees Sep 02 '20 at 18:44
  • Not sure the double hop concept applies. but new to PS and remoting. As I see it Server A executes an invoke-command to run a ps1 script on a remote server, A launches script on B, no C involved. – Trees Sep 05 '20 at 04:08
  • Not sure the double hop concept applies. but new to PS and remoting. As I see it Server A executes an invoke-command to run a ps1 script on a remote server, A launches script on B, no C involved. And the script does execute, I echo variables set in the script to a log and the transcript of that script and I see the passthru results from the Start-process. What is not happening is seeing any error message and I do not see expected output files from the exe being run by the start-process. – Trees Sep 05 '20 at 04:14
  • The Start-Process runs an exe which needs an Alteryx workflow passed to it as an argument, which it is in the argument list of the Start-Process and runs fine if the script runs local. But when triggered remotely it seems not to pass the argument or the symptoms make it seem so to me. – Trees Sep 05 '20 at 04:15

0 Answers0