Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Executing a Powershell script using Scheduler

rcreed
5 - Atom

I am attempting to schedule a command line to run overnight that executes a powershell script.

 

  • The scheduler is setup to run as my user when I am logged out of the machine.
  • The scheduled task executes successfully (green light) but ultimately the end result of the powershell script is not executed.
  • The Alteryx workflow executes successfully when I manually run the job.

 

Please let me know if you have any ideas on how to resolve.

5 REPLIES 5
jrgo
14 - Magnetar

Not sure if the output file the tool creates is used by your PS1 script, but if it is, the issue could be that it's not in a location that you may expect it to be in. I've noticed that %temp% can sometimes result in something different on a server vs. locally running.

 

However, if it's not referencing, you may try to update parameters indicated below as shown. 

 

jrgo_0-1614023128833.png

 

Hope this helps!

 

Jimmy

 

rcreed
5 - Atom

Thanks Jimmy, I think we are getting closer.

 

I did input your suggested edits (attachment named "Alteryx 3.PNG") and remove the output. Powershell opened locally on my machine when I ran Alteryx manually. However, the end result from the powershell script being executed was not obtained. 

 

I then tried to enter the powershell script directly in the command line (Alteryx 4.PNG) which did open and execute powershell on my machine locally. However, I am running into the same issue as before: when I setup the job to run on the scheduler the scheduled workflow will successfully run but the powershell script is not executing.

 

All the scheduled jobs complete within 1 minute 40 seconds. Unsure if that is indicative of an escape within the scheduler tool?

 

-Cody

jrgo
14 - Magnetar

In regard to your scheduler, is that on an actual Windows Server running an Alteryx Server instance or something else?

 

Reason I ask is because I noticed that on the 4th screenshot, it looks to be calling some function that requires Excel. Common that an Server doesn't have Excel, or any other application not needed for Alteryx to operate, installed so when that powershell runs, it fails because it doesn't have applications available to do so.

 

If your Server does have Excel installed, the only other thing I can think of is that your function may not work when running as a background process and requires an interactive process in order to complete the script.

 

That said, I could be completely wrong, but is what comes to mind based off what I'm able to gather from what you've shared.

rcreed
5 - Atom

I'm unsure if it is on the Windows Server. I know that we do not have the Alteryx Server so I am running the "desktop designer with scheduler" version. I do have the ability when I setup the scheduled job to run "on disk" or "in scheduler DB". The default is to run in scheduler DB so I tried to run it on disk this morning thinking that might get around your Windows/Excel idea but it yielded the same results.

 

 

jrgo
14 - Magnetar

Oh I see. Yeah the run from "On disk" option is just to tell the scheduler where to grab the workflow to run from, but it will still execute and reference local resources within the scheduler machine.

 

Again, even if Excel is installed on the scheduler machine, it still may not work. I'd suggest researching the functions/commands your PS1 script is executing to see if they work when running as a background job or if it requires an interactive environment. If the latter, you may need to come up with another solution since scheduler always runs jobs as a system job in the background.

Labels