I have a problems that I'm trying to solve, but can't seem to figure the key part out. We have tons of records that we process every day using a .jar file, but the problem is that we have to go one by one and that is time consuming. I think we can cut a tremendous amount of time if we use a powershell script.
The problem is that I don't know how to pass the parameters from a csv to a function in powershell.
My csv looks like this
NAME,ID
-------
John,18
Dave,19
Carmen,20
Eric,21
Tom,22
Lisa,23
Kyle,24
The function is
function CreateUser
& java -jar --create -user $name -id $id -file D:/HR/$name-$id-form.pdf
I imported the csv file using
$dataCSV = "D:\HR\Input\20150303NewUsers.csv"
$data = Import-Csv $dataCSV
So I need something that will go systematically down the file and pass the name field inside the csv as $name and the ID field as $id over and over again until completed. But I can't figure out how to pass those two down on a ForEach-Object method :(
I'm stuck... I've been fighting this all weekend, but nothing.
Any help or guidance will be greatly appreciated! Or if anyone know how to do this in python, that will be cool too! :)