Page 1 of 1

Running Powershell scripts

Posted: Tue Sep 24, 2024 8:45 pm
by FrankT
I am attempting to run a Powershell script but cannot get it to run. I have tried "Run Command" and "Execute Command" and it does not seem to run

For the "Run Command" I have these parameters:
Shell - Powershell
Command - d:\testing\test.ps1

For the "Execute Command" i have the parameters:
path d:\testing\test.ps1

I am using Firestarter to start the flow.
This script will delete folders.
Does anyone have ideas?. Tanks!

Re: Running Powershell scripts

Posted: Wed Sep 25, 2024 9:24 am
by freddyp
I have no experience with the "Run Command" app. As to "Execute command" the mistake is that "Command or path" should point to powershell.exe, the path to the script is part of the "Arguments".

If you need to delete files and folders have a look at the "File Pool Cleanup" app that is part of https://www.enfocus.com/en/appstore/product/folder-apps. Perhaps that is a better fit for what you need to do?

Re: Running Powershell scripts

Posted: Wed Sep 25, 2024 9:57 am
by sander
With Execute command you can run it like this:
ps1.png
ps1.png (15.44 KiB) Viewed 18862 times
Edit: changed screenshot, makes more sense now :)

Re: Running Powershell scripts

Posted: Thu Sep 26, 2024 4:00 pm
by FrankT
Thank you! this is working for me.

Re: Running Powershell scripts

Posted: Tue Oct 01, 2024 3:58 pm
by FrankT
I have one more question.

How do I run the script if it has arguments? I tried placing the argument in the same quotes and it didnt work. I tried separate, as bbelow, and it doesnt work either?

-nologo -windowstyle hidden -executionpolicy bypass -file "D:\Testing\Folder count\Project_folder_cleanup.ps1" -ProjectsDir 'D:\ESO_Testing\Projects'

Re: Running Powershell scripts

Posted: Tue Oct 01, 2024 4:21 pm
by jan_suhr
You can use the app "Execute command friend" to create a Batch or Shellscript file that you run in Execute Command or Powerscript.

The applets you add variables from Switch in an easy way.

https://www.enfocus.com/en/appstore/pro ... and-friend

Re: Running Powershell scripts

Posted: Tue Oct 01, 2024 4:47 pm
by sander
This is my internal powershell example flow/script, it shows all the magic :)
theExample_ps1.png
theExample_ps1.png (184.88 KiB) Viewed 18564 times

Re: Running Powershell scripts

Posted: Fri Oct 04, 2024 9:54 am
by Padawan
If you wish to run a powershell script from Run Command in Powershell mode, then you have to build it in the same way as you would when starting a powershell script from another powershell script. Meaning that you have to place a "&" before the path to the script to be executed.

Code: Select all

& "C:\Path\To\script.ps1" -ArgumentName ArgumentValue