Quantcast
Channel: PowerShell General
Viewing all articles
Browse latest Browse all 10624

Need help with Invoke-Expression

$
0
0

Hello everyone!

I am in need of assistance with Invoke-Expression. In my script I need to build function names to match the domain the script is being ran in.

For example, a function is named as Tool-TEST.AM.ORG-ValidateCSV. Now, building a variable that contains dynamically generated name of the function which is then called by Invoke-Expression is not the problem.

The problem is piping. I have an array variable containing data which I need to pipe into the function earlier, like so $CSV | Tool-TEST.AM.ORG-ValidateCSV. I have tried many different methods to pipe $CSV into the function but none have succeeded.

I googled up this page: http://blogs.msdn.com/b/powershell/archive/2007/03/07/invoke-expression.aspx but I didn't really understand it well enough to get this working by myself.

PowerShell version is 2 because the script calls Exchange cmdlets which require v2.

I appreciate your help, thanks in advance!


Viewing all articles
Browse latest Browse all 10624

Trending Articles