Reputation: 1
I would like to have unique entries in the output files.
$addedRecords = 0
for ($i = 0; $i -lt $rightsFileContent.Length; $i++) {
Export-Csv $outRightsFile -InputObject $rightsFileContent[$i] -Append -Force -Delimiter ";"
$addedRecords = $addedRecords + 1
}
I thought of Select-Object
and -Unique
, but how can I use it here?
Upvotes: 0
Views: 45
Reputation: 200293
Don't use a for
loop.
$rightsFileContent |
Select-Object -Property '*' -Unique |
Export-Csv $outRightsFile -Delimiter ';' -NoType -Append -Force
$addedRecords = $rightsFileContent.Length
Upvotes: 1