Alteryx Server Discussions

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

Running PowerShell script on the Alteryx Server

DeorajK
7 - Meteor

Hello,

Can you please advise if it's possible to run an PowerShell script on the Alteryx Server? If it's possible how should it be configured?

I was able to run the script locally with the below configuration, but unsuccessful with the configuration using a share drive location and also unable to run on the server. Thanks in advance for your response.

DeorajK_0-1607963965930.png

 

7 REPLIES 7
DeorajK
7 - Meteor

Thank you for your response.

Yes, the machine does have access to the share drive.

Here is the error:

DeorajK_0-1608055652655.png

Unfortunately, none of these links was helpful.

 

I also noticed the Command tool does not work to run PowerShell scripts that are stored on my share drive. I got the same error 1 message.

Is there a particular way to configure the Command tool to run PowerShell scripts that are stored on the share drive? Below is my current configuration.

 

Command Arguments(Optional):

Powershell.exe -executionpolicy remotesigned -File '\\xx\xx\xx\xx\TEMP\xxxj\powershellhelloworld\SOX_AD_Group_Monitoring.ps1'

 

Read Results(Optional):

\\xx\xx\xx\TEMP\xx\powershellhelloworld\AD_Group_Monitoring*.txt

 
 

 

 

 

 

RishiK
Alteryx
Alteryx
DeorajK
7 - Meteor

Thanks for the response.

Unfortunately, it's not a scheduler problem I'm having. 

Nikita-Puniani
7 - Meteor

Hi,  did this work for you? 

RishiK
Alteryx
Alteryx

@DeorajK have you tried to test the command line commands outside of Alteryx?

FlorianC
Alteryx
Alteryx

Hi @DeorajK,

 

Have you managed to get your workflow running successfully?

 

There are two potential issues that I see from the screenshot of the run command tool configuration:

1. You are calling the PowerShell executable file from within a PowerShell environment. Indeed, the command part of the configuration will start PowerShell thus eliminating the need to add this in the command arguments. Your arguments should simply be as follow:

 

-ExecutionPolicy "RemoteSigned" -File "C:\Users\xxxxd\xx.ps1"

 

2. The script referenced in the arguments is hosted locally on you machine with an absolute path that is inaccessible from the outside. There are two options to remedy to this:

    1. You can either share the file with the remote machine and prefix the path with your hostname to make it a UNC:

 

-ExecutionPolicy "RemoteSigned" -File "\\hostname\C$\Users\xxxxd\xx.ps1"

    2. You can change the path to a relative reference and include the script as an asset in the workflow itself while publishing it to Server.

        - Attaching additional files to a workflow package (yxzp file)

        - Assets and Packaging Workflows

 

-ExecutionPolicy "RemoteSigned" -File "xx.ps1"

 

Please find attached an example workflow demonstrating how this can be achieved.

Florian Carrier
Strategic Solution Consultant
Alteryx