Scripted Actions Tip: Use $InheritedVars in StringArray supported Param

So I noticed when using a function in powershell and passing a string array as param from a $inheritedvar that these always gets wrapped between double quotes.

So e.g. "Value1","Value2"

Will turn into ""Value1","Value2""  This will not be accepted so you need to remove the extra added double quotes.

So you can use a simple Trim and Split like the example below to clean up the extra double quotes:

$stringArray = $InheritedVars.LanguagePacks.Trim('"').Split(',')

Install-LanguagePack -LanguageList $stringArray

Comments (1 comment)

Dave Stephenson

Awesome pointer!

Thanks, Jan. 🙂


Please sign in to leave a comment.