PowerShell - Pass Dynamic Arguments from Function to Function
If you are interested in passing dynamic arguments from function to function in PowerShell, I think the following will help you out: Create the function(s) like this function MyFunction1 { [CmdletBinding()] param ( [string]$requiredParm1, [string]$requiredParm2, [parameter(ValueFromRemainingArguments=$True)] $dynamicArgs ) $props = @() if($dynamicArgs) { $num = 0 for ($num = 0; $num -lt $dynamicArgs.Count; $num = $num + 2) { $format_string = (([string]$dynamicArgs[$num]) + " '" + [string]$dynamicArgs[$num+1] + "' ``") $props += $format_string } } $string_props = $($props | Out-String) $second_function = "MyFunction2 -requiredParm1 $requiredParm1 " $second_function += "-requiredParm2 $requiredParm2 " $second_function += "$string_props;" Invoke-Expression $second_function } function MyFunction2 { [CmdletBinding()] param ( [st...