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

**URL:** <https://forums.powershell.org/t/csv-output-contains-thousands-of-duplicates-of-the-first-record-object/14619>\
**Category:** PowerShell Help\
**Created:** [July 1, 2020, 8:31pm UTC](https://forums.powershell.org/t/csv-output-contains-thousands-of-duplicates-of-the-first-record-object/14619 "2020-07-01T20:31:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jason-colotario](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jason-colotario](https://forums.powershell.org/u/jason-colotario)\
**Post date:** [July 1, 2020, 8:31pm UTC](https://forums.powershell.org/t/csv-output-contains-thousands-of-duplicates-of-the-first-record-object/14619/1 "2020-07-01T20:31:13Z")

</div>

```
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

}
```

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [July 1, 2020, 9:35pm UTC](https://forums.powershell.org/t/csv-output-contains-thousands-of-duplicates-of-the-first-record-object/14619/2 "2020-07-01T21:35:33Z")

</div>

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

Thanks.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:29pm UTC](https://forums.powershell.org/t/csv-output-contains-thousands-of-duplicates-of-the-first-record-object/14619/3 "2024-05-16T20:29:16Z")

</div>

Closed on May 16, 2024, 8:29pm UTC


