Run PowerShell Script incoming Job

Post Reply
ChristianK
Newbie
Posts: 13
Joined: Wed Nov 30, 2022 1:15 pm

Run PowerShell Script incoming Job

Post by ChristianK »

Hi,
I have a PowerShell script that recursively delete specific named subfolders from a root folder, works fine.
I'd like to use it with Switch to automate deletions from input folder.
My little script is this one :
Get-ChildItem -path e:\inputFolder\ -Include 'FoldertoDelete' -Recurse -force | Remove-Item -force -Recurse

I want to use it instead a flow I made, works well when I set Submit Hierarchy with specific subfolders level, but if the hierarchy change in the input folder, then it doesn't work, the level of subfolders can be different from one input folder to others....

That's why I'd like to use my script, works for any level of subfolders.
Must I use generic application or execute command ? And If I use it, it will execute once for a input folder, or for each elements in its ?

Thanks ,
Christian
freddyp
Advanced member
Posts: 1008
Joined: Thu Feb 09, 2012 3:53 pm

Re: Run PowerShell Script incoming Job

Post by freddyp »

"Execute command" would be the one to use. There is an app that is easier to use for PowerShell scripts: https://www.enfocus.com/en/appstore/product/run-command

The script will be executed every time an input job hits the element/app, so if you want your script to run at regular intervals send a dummy file to kickstart it. There are two options for doing that. Use the outgoing connection of "Hold job" if you want the script to run at a specific time of the day, or use the app "FireStarter" if you want it to run immediately when you start the flow and then every x minutes/hours.
ChristianK
Newbie
Posts: 13
Joined: Wed Nov 30, 2022 1:15 pm

Re: Run PowerShell Script incoming Job

Post by ChristianK »

Great !! It's works fine ! Thanks for the tip FreddyP ! I've modified my flow with this app, and it made the job !
Thanks again !
Regards,
Christian
Post Reply