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 does the machine that the Alteryx Server is running on have access to the shared drive?
What sort of error(s) do you get on the Server?
These links may help you:
https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/How-To-Use-PowerShell-with-Alteryx/...
https://community.alteryx.com/t5/Alteryx-Server-Discussions/Alteryx-Gallery-Server-Powershell-quot-E...
https://community.alteryx.com/t5/Alteryx-Designer-Discussions/How-to-run-an-Alteryx-workflow-through...
Thank you for your response.
Yes, the machine does have access to the share drive.
Here is the error:
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
@DeorajK give this link a go and see if the solution in it helps you
https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Run-Command-failing-on-scheduler/td-p/...
Thanks for the response.
Unfortunately, it's not a scheduler problem I'm having.
Hi, did this work for you?
@DeorajK have you tried to test the command line commands outside of 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.