I have a script, for example:
$in_file = "C:\Data\Need-Info.csv" $out_file = "C:\Data\Need-Info_Updated.csv" $list = Import-Csv $in_file ForEach ( $user in $list ) { $zID = $user.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 } }
However, I cannot get it to output all the results to the $ out_file file, as it does not seem to add data to the csv file. I have tried several things, ideas and suggestions found on the Internet. None of them seem to work, and I feel like I'm missing something quite simple here. Is there any way to do this adding data to a file? If so, can you give an example or piece of code to make it work this way? I do not ask you to rewrite all the code or something like that, just a way to add exported data to the file that is being output.
source share