Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

Alteryx Designer Desktop Discussions

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

powershell script through run command tool

curator_at_work
8 - Asteroid

hoe to configure run command tool to execute following powershell script

" Get-ChildItem -Path "C:\" -Recurse | Select-Object FullName,

    @{Name="Size (Bytes)";Expression={$_.Length}},

    CreationTime,

    LastWriteTime |

Export-Csv -Path C:\downloads\DriveContent9.txt -NoTypeInformation

"

your small help means a lot to me

11 REPLIES 11
MeganBowers
Alteryx Community Team
Alteryx Community Team

Hi @curator_at_work, check out this solved discussion post with an example attached to get you started with configuring the command tool to run powershell: https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/Using-Run-Command-tool-to-exec...

 

curator_at_work
8 - Asteroid

not so helpful

MeganBowers
Alteryx Community Team
Alteryx Community Team

Sorry to hear the discussion post wasn't helpful! Do you have an in-progress workflow you could share or an error message you are getting?

flying008
15 - Aurora

Hi, @curator_at_work 

 

1- Command:

PowerShell.exe

 

2- Command Arguments [Optional]:

-ExecutionPolicy Bypass -Command "& {Get-ChildItem -Path 'C:' -Recurse | Select-Object FullName, @{Name='Size (Bytes)';Expression={$_.Length}}, CreationTime, LastWriteTime | Export-Csv -Path 'C:\downloads\DriveContent9.txt' -NoTypeInformation}"

 

录制_2025_02_06_10_35_23_81.gif

apathetichell
20 - Arcturus

@flying008-> can you share your wisdom on this thread too (https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/Run-Command-Tool-configuration...) -> it's basically an identical use case

flying008
15 - Aurora

Hi, @apathetichell 

 

IMHO, Ask real questions, Get the complete answer!
At present, @curator_at_work  did not describe in detail what the real needs are.


1- If you only want to manually enter the script content in the Run Command tool, you can refer to the setting animation above. The only thing to pay attention to is the Output and Input in the dialog box. You can ignore the Input, and the Output can set any file name under the temporary folder path. It is best to add a Sample tool before the Run Command tool to let it output only one line of records. This will reduce unnecessary disk overhead and will not affect the script running.


2- If you want Run Command to accept the script as the output from the previous tool, you need to use a tool like Formula or Txt Input to generate the content of server.ps1, and then use Output in the Run Command tool to receive the full path of server.ps1, and then fill in the parameters and run it according to the syntax similar to powershell.exe -ExecutionPolicy Bypass "d:\123\server.ps1".

 

3- However, it's a good idea to describe your desired result and show it with screenshots if you can. @curator_at_work 

curator_at_work
8 - Asteroid

thanks @flying008  for your detailed efforts i want to know 
what's there in text input tool ?

curator_at_work
8 - Asteroid

hi @flying008 

I do exact the same config, getting below error, have a look

 

I think we are missing something, because the code that I am passing in text input tool, the same I am getting in drivecontent9.txt file that I am using in output of run command tool.

 

curator_at_work
8 - Asteroid

hi @MeganBowers 
I shared on this same thread , you can look at.

Labels
Top Solution Authors