I am having a hard time comparing two CSV files in an intuitive way. I basically have a dump of all GPO settings with three columns: GPO Name, Setting Path, and Setting Value. When I simply compare lines via the "Compare-Object" cmdlet, it does not return what I want:
$file1 = import-csv -Path "C:\Scripts\GPOCompare\GPOExport1.csv" $file2 = import-csv -Path "C:\Scripts\GPOCompare\GPOExport2.csv" Compare-Object $file1 $file2 | Select-Object -ExpandProperty inputobject
The input files look like this:
GPO Name,Setting Path,Setting Value
I basically want to compare all paths and values for each GPO in two different files. So basically, the logic would be: For GPO1, look at all paths and values and if there are any differences (the corresponding settings may not be on the same lines in the csv files), output to file or add pscustomobject for differences in that GPO to an array and then export array to csv once complete. I'm thinking I need to look at one GPO a time, compare all lines, and output differences in settings and/or values to a new CSV. Can someone please point me in the right direction?
You must be logged in to reply to this topic.