thanks to Stackoverlfow: https://stackoverflow.com/questions/8799847/compare-two-csv-files-and-find-discrepancies
The code snippet is about comparing two CSV files containing firewall object groups and list down the discrepancy. the code snippet can be used to out-file to a text.
[System.Collections.ArrayList]$base = Get-Content "C:\Temp\reference_ip.csv" [System.Collections.ArrayList]$diff = Get-Content "C:\Temp\difference_ip.csv" $notmatching = @() foreach ($ip in $base) { if (!$diff.Contains($ip)) { $notmatching += $ip } } Write-Host "Not Matches : " foreach ($value in $notmatching) { $message += $value + [Environment]::NewLine } Write-Host $message