Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Passing pipeline variable to functioin

$
0
0

Hey Scripting Guy,

How do I pass a pipeline variable to another function?

Example:

I have a .csv file with a list of users First and Last name. I need to get the users sAMAccountName and pass it to another function.

Here is my code:

$intakelist = Get-Content c:\userlist.csv

foreach($name in $intakelist){

Get-QADuser $name -searchroot $search -SearchScopt subtree -IncludedProperties sAMAccountName | .\get-someotherfunctioin.ps1 $_

}

When I try this code it calls the get-someotherfunction with an empty variable.


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>