Sometimes you have two sets of data and you want to compare them, or find the difference. Perhaps you want to get find out which rows are in CSV (or Excel worksheet) but not in another, or you need to compare two columns. Either way, if you export the data to a CSV, powershell can do the rest pretty easily.
The following command uses “diff” which is an alias for “compare-object” to look at two separate files, and export the differences to HTML.
PS C:\> diff (get-content z:\shared\processes.csv) (get-content z:\shared\processes1.csv) | convertto-html > z:\shared\d iff.html
If for example you had lists of files, processes, customer records, you could use this pretty easily to see the difference.
Of course this actually works better too if you work with XML, because you can then use the “-property” parameter to focus on individual parts of each line (the column in Excel-speak).
So something like this:
PS C:\process> diff (import-clixml c:\process\process1.xml) (import-clixml c:\process\process2.xml) -property Name | con vertto-html > c:\process\process.html