Powershell - Compare 1 column from two CSV's
Go to solution
Solved by Fallen Soul,
So according to the post i had posted on Stack Exchange, i need to state which properties to compare.
https://stackoverflow.com/questions/67051420/powershell-compare-two-files-not-showing-correct-data
Compare-Object -ReferenceObject $term1 -DifferenceObject $term2 -Property 'parent ID','Folder Name','Folder Code 1' | Where-Object {$_.SideIndicator -eq '=>'}
While working on this further, i discovered that there was some trailing white space in the Folder code.
Update:
While finalising this job I discovered, that using all columns in the -property option, is not the correct method. This will compare all data which is not the best option. Well at least for this task. What I needed to do was select one column and then use the -PassThru switch after.
So finally part of the code will look like this:
Compare-Object -ReferenceObject $term1 -DifferenceObject $term2 -Property 'parent ID' | Where-Object {$_.SideIndicator -eq '=>'}
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now