We are aware of an issue with the Search bar. Please use Advanced search for the time being while we troubleshoot. Thanks for your patience as we work on improving the community!

Alteryx Designer Knowledge Base

Definitive answers from Designer experts.

How To: Use PowerShell with Alteryx

Ozzie
Alteryx
Alteryx
Created

 

Alteryx can use the Run Command Tool to run Powershell scripts and perform any Powershell specific commands. Note that in order to run PowerShell scripts you must make sure you have scripting enabled. You should consult with your IT department to see if you are allowed to enable this functionality.

 

Below is an example I made demonstrating the necessary run command tool configuration. The command will just be “PowerShell” to enable PowerShell mode in cmd.exe. Then your command arguments should be the path where the script is located so it can run:

 

 

2019-04-22_10-44-39.png

 

 

In this particular case, I want to read into the Designer the results of my script, so I specify the file that is being written as the Read Results. My “helloworld.ps1” script only contains the below:

 

"Hello World" | Out-File c:\temp\test1.txt

 

 As you can see, this kicks off in the Designer and opens the script output file to continue downstream, successfully implementing Powershell scripting:

 

powershellbrowse.jpg

Attachments
Comments
Inactive User
Not applicable

I have noticed powershell is not working anymore after upgrading to 11.7. Can you confirm?

jdrummey
9 - Comet

Hi, this was helpful, thanks!

 

One note - I had a script located in a folder with spaces in the name like C:\foo bar\baz.ps1 and had to use single quotes instead of double quotes in the Command Arguments, e.g. & 'C:\foo bar\baz.ps1' worked while  & "C:\foo bar\baz.ps1" errored out with error code 1.

 

Jonathan

 

BretCarr
9 - Comet

@jdrummey : did you ever figure this out? I was having the same issue and I believe that it is just where your quotes are.

 

Run External program:

powershell

 

Command Arguments [Optional]:

'& "C:\foo bar\baz.ps1"'