Alteryx Server Discussions

Find answers, ask questions, and share expertise about Alteryx Server.
SOLVED

Running powershell through server not working

JohnLight
8 - Asteroid

I'm getting this error when trying to run a workflow that runs .bat files through powershell. When I run the workflow manually, everything runs fine, but if I try to schedule it, this is what is returned. Any suggestions on how to fix this?

4 REPLIES 4
KPOLU
8 - Asteroid

Hello John,

 

I had similar issue with executing powershell from Alteryx server. This is what I did.

 

Run Command tool Configuration:

 

1. Command - powershell

2. Command Arguments - &".\script.ps1"

3. Working Directory - Folder where the script is present.

 

The problem here is you can't embed your powershell script as part of your workflow and use it. Also, you can't execute the script from a network location on your server due to default security settings on the server. 

So, I followed below steps

A. Keep your powershell script in network location where your server's runas account has access to.

B. Create batch script which copies the powershell script file from network location to a temp location on the server (e.g. c:\temp). Execute this batch script using workflow event 

C. Use temp location as working directory (input 3).

D. Create another batch script which deletes the powershell script file copied in STEP B in the end.

 

This approach worked for me.

 

-Krishna 

JohnLight
8 - Asteroid

Where do find the network location in part A? And what does you batch script look like in part B? I don't have much experience with .bat files.

KPOLU
8 - Asteroid

Network location is basically a shared drive. it goes something like this (\\computername\folder\). You and your alteryx server run-as account should have access to this folder. Your server admin may help you on this. Regarding batch script, it's a .bat file having single line of code 

(Copy [source] [destination])for copying your powershell script file.

ErlinaIrvine
5 - Atom

Hi I'm having a similar issue on Gallery and have a few questions.

 

1. Is D optional? If not, what is the reason for it? 

2. For C, does it have to be a temp location?