CSV output contains thousands of duplicates of the first record/object

Hello,



Below script is working now but the data in the CSV is all duplicates of the first record/object. Curious why the data is repeating when it should be unique record for each object in the base variable.



$obj = @()

$base = NETAssignmentsModified

For ($i=1; $i -le 20000; $i++){

Foreach($b in $base){

}

$result = $obj += [PSCustomObject]@{
#breakout all the essential object items
EID = $b.specialbill.id -as [String]
Vendor = $b.vendorName -as [String]

}

$result|export-csv -path "c:\users\BWiley\MyData$((Get-Date).ToString("MMddyyyy")).csv" -NoTypeInformation

}

Please do not re-post the same question more than once.

Thanks.