I have a script that grabs a series of information from SQL. It then parses the information and passes it to a series of arrays. I want to then pass each array to a separate script.
I've seen Start-job should be able to do this but form my testing it didn't seem to work. This is what I have tried. Each Script individually works, and I am currently just using CVS's to pass the information.
Once the information is in the script I need to be able to call specific properties from each object. I did get it to just print the array as a string, but I couldn't call anything specific.
Invoke-Sqlcmd -Query $Q1 -ServerInstance $I -Database $DB | Export-Csv "$Files\Employees.csv"
$emps = Import-Csv "$Files\Employees.csv"
$newaccounts = @()
$deacaccounts = @()
$changedusers = @()
if(Test-Path -Path "$Files\Employees.csv"){
    foreach ($emp in $emps) {
        if ($emp.emp_num.trim() -ne $emp.EmpNum) {
           $newaccounts += $emp 
        }
        if ($emp.emp_num.trim() -eq $emp.EmpNum) {
            if ($emp.fname -ne $emp.GivenName -and $emp.lname -ne $emp.SurName) {
                $deacaccounts += $emp
                $newaccounts += $emp
            }
            else ($emp.dept -ne $emp.DepartmentNumber -or $emp.job_title -ne $emp.JobTitle) {
                $changedusers += $emp
            }
        }
    }
}
Start-job -path "script" -argumentlist (,$deacaccounts)
Start-job -path "script" -argumentlist (,$changedusers)
Start-job -path "script" -argumentlist (,$newaccounts )
EDIT: The Information passed to the scripts would be multiple lines of employee data. I need to be able to grab that info in the "Sub" scripts and perform actions based on them.
EX: Deacaccounts =
| fname | Lname | empnum | 
|---|---|---|
| ted | kaz | 1234 | 
| sam | cart | 245 | 
 
    