I have multiple reports for people in DLs I am producing where I use the below logic to combine newly added people to existing people in the DL in a CSV.
It works when there is more than 1 new user record in the newly added file, but if there's only 1 record, I get the below error and I'm not sure why?
$csv = import-csv "C:\somefile.csv"
$csv1 = import-csv "C:\somefile1.csv"
$both = $csv + $csv1 | export-csv "C:\newfile.csv"
which results in this error
Method invocation failed because [System.Management.Automation.PSObject] does not contain a method named 'op_Addition'.
At line:1 char:1
+ $Both = $csv + $csv1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (op_Addition:String) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
Appreciate some insights. Thanks