I have a script such as the following:
$in_file = \"C:\\Data\\Need-Info.csv\"
$out_file = \"C:\\Data\\Need-Info_Updated.csv\"
$list = Import-Csv $in_file
Fo
Convert the foreach loop into a foreach-object and move the export-csv to outside the outter foreach object so that you can pipe all the objects to the export-csv.
Something like this (untested):
$list | ForEach {
$zID = $_.zID
ForEach-Object { Get-QADUser -Service 'domain.local' -SearchRoot 'OU=Users,DC=domain,DC=local' -SizeLimit 75000 -LdapFilter "(&(objectCategory=person)(objectClass=user)(PersonzID=$zID))" |
Select-Object DisplayName,samAccountName,@{Name="zID";expression={$zID}} |
}
} |Export-Csv $out_file -NoTypeInformation -Force