powershell - Calling all functions with certain signature -
i have module (psm1 file), have set of function. need phone call functions in module, take 1 parameter (an array of pstoken). obviously, can straight phone call functions, need changes in module, didn't require changes in calling script. how can this?
you can utilize get-command commandlet iterate on functions in given module, , phone call each function using dot-sourcing:
import-module mypowershellmodule $arrpstoken = @($token1, token2, token3) get-command -module mypowershellmodule | select-object -expandproperty name | foreach-object { . "$_" $arrpstoken } keep in mind code assumes functions have same signature, risky.
powershell
No comments:
Post a Comment