With EB 3, how do you run a powershell script with parameters?

Carol Wapshere 8 years ago • updated by anonymous 4 years ago 5

I am attempting to run a powershell script with parameters. If I was running it from the powershell command line I would do this:

E:\scripts\truncate-table.ps1 -server "localhost" -database "FIMData" -table "View500ADReporting_Delta"

I have tried to use the Powershell Function Operation.

First I am confused by "Module path" which sounds like might mean a PSSnapin. I assume this is supposed to mean script and enter "E:\scripts\truncate-table.ps1"

Next I am confused by "Function name". In the documentation there is a picture where the word "Execute" has been entered here. I tried that but wasn't too surprised when I got an error. I also cannot leave it blank.

Finally I enter this for the parameters:

So the question is: how am I supposed to fill in the fields so it calls the script with the parameters?

I think the documentation may need clarity. Also the form should be redesigned so someone who knows about powershell scripts, but not about "modules", can figure it out.


Hi Carol,

The behaviour you're describing cannot be achieved in the current version of EventBroker, with that said this is not the intention and a plugin has already been written to accept PowerShell commands more akin to what would be entered into the PowerShell command shell.

This will be available in the next version of EventBroker for which we will have another release candidate of shortly.


Is it not possible to write a Powershell module with a function with the same parameters that will invoke the script as a workaround?

This will absolutely work, as has been tested and confirmed with the following PowerShell script:

Function InnerExecute($server, $database, $table)
   . 'C:\truncate-table.ps1' -server $server -database $database -table $table

You'll just need to update the file-path inside the inner execute function and point EventBroker towards it. This is only a work-around and will not be necessary in the next release candidate.

Reassigned for confirmation.

My current workaround is to hard-code the values in a seperate copy of the script and run it using the other powershell operation in EB. Probably won't have time for anything more on this project. Will be good to see powershell scripts handled more simply in the next version of EB (cos I heart powershell)