# PowerShell Action fails when trying to add paramaters in BeforeAction

**URL:** <https://www.finalbuilder.com/forums/t/powershell-action-fails-when-trying-to-add-paramaters-in-beforeaction/3300>\
**Category:** Bugs\
**Created:** [September 24, 2010, 6:10am UTC](https://www.finalbuilder.com/forums/t/powershell-action-fails-when-trying-to-add-paramaters-in-beforeaction/3300 "2010-09-24T06:10:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nelsonwolf](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/n/b9e5f3/32.png) [@nelsonwolf](https://www.finalbuilder.com/forums/u/nelsonwolf)\
**Post date:** [September 24, 2010, 6:10am UTC](https://www.finalbuilder.com/forums/t/powershell-action-fails-when-trying-to-add-paramaters-in-beforeaction/3300/1 "2010-09-24T06:10:58Z")

</div>

FinalBuilder 6.3.0.2140

I'm trying to build up the parameter list dynamically, but it causes the action to fail:

Both of these fail in the BeforeAction of a PowerShell action.

Action.PropertyStore.ScriptParameters.Clear();

Action.PropertyStore.ScriptParameters("-myparam value");

Error Executing script : BeforeAction

Microsoft JScript runtime error  
Object doesn't support this action

Line : 3

Char : 1

Error in BeforeScript : JavaScript, This Action did not execute.

  

I'm able to work around this by building up the parameter list into a variable and then just adding that variable as 1 paramater to the PowerShell script, but I thought I would let you know about the bug.

---

<div class="post-metadata">

**Author:** ![paulsamways](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/p/e8c25b/32.png) [@paulsamways](https://www.finalbuilder.com/forums/u/paulsamways)\
**Post date:** [September 29, 2010, 12:05pm UTC](https://www.finalbuilder.com/forums/t/powershell-action-fails-when-trying-to-add-paramaters-in-beforeaction/3300/2 "2010-09-29T12:05:47Z")

</div>

Hi Nelson,   
  
 You’ll need to use the PropertyAsStrings function to get a reference to the ScripParameters collection, for example:   
  
 var params = Action.PropertyStore.PropertyAsStrings(“ScriptParameters”);   
 params.Clear();   
 params.Add("-myparam value");   
  
 The fact that the code completion is showing Action.PropertyStore.ScriptParameters as a valid property is a bug.   
  
 Regards,   
 Paul.

---

<div class="post-metadata">

**Author:** ![nelsonwolf](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/n/b9e5f3/32.png) [@nelsonwolf](https://www.finalbuilder.com/forums/u/nelsonwolf)\
**Post date:** [September 29, 2010, 12:07pm UTC](https://www.finalbuilder.com/forums/t/powershell-action-fails-when-trying-to-add-paramaters-in-beforeaction/3300/3 "2010-09-29T12:07:44Z")

</div>

Ah I see. Thanks Paul!
