# Get old list of names from file
$oldnames = import-csv oldlist.csv
# Collection to store custom objects
$myobjs = @()
foreach($name in $names)
{
# Get old count
$oldcount = $oldnames | ?{$_.name -eq $name} | %{$_.count}
# create custom object
$myobj = "" | Select Name,Count
$myobj.name = $name
$myobj.count = $oldcount + 1
}
$myobjs | export-csv oldlist.csv -noType
|