Running Powershell scripts

Post Reply
FrankT
Newbie
Posts: 19
Joined: Tue Jul 30, 2024 7:20 pm

Running Powershell scripts

Post 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!
freddyp
Advanced member
Posts: 1129
Joined: Thu Feb 09, 2012 3:53 pm

Re: Running Powershell scripts

Post 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?
sander
Advanced member
Posts: 308
Joined: Wed Oct 01, 2014 8:58 am
Location: Den Bosch

Re: Running Powershell scripts

Post by sander »

With Execute command you can run it like this:
ps1.png
ps1.png (15.44 KiB) Viewed 18742 times
Edit: changed screenshot, makes more sense now :)
FrankT
Newbie
Posts: 19
Joined: Tue Jul 30, 2024 7:20 pm

Re: Running Powershell scripts

Post by FrankT »

Thank you! this is working for me.
FrankT
Newbie
Posts: 19
Joined: Tue Jul 30, 2024 7:20 pm

Re: Running Powershell scripts

Post 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'
jan_suhr
Advanced member
Posts: 687
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Running Powershell scripts

Post 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
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
sander
Advanced member
Posts: 308
Joined: Wed Oct 01, 2014 8:58 am
Location: Den Bosch

Re: Running Powershell scripts

Post 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 18444 times
Padawan
Advanced member
Posts: 364
Joined: Mon Jun 12, 2017 8:48 pm
Location: Belgium
Contact:

Re: Running Powershell scripts

Post 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
Post Reply