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
2

Comments (1 comment)

Avatar
Dave Stephenson

Awesome pointer!

Thanks, Jan. 🙂

0

Please sign in to leave a comment.