Compare two .CSV files and output the duplicate names

ShadowSF96

I'm new to Powershell, and the title pretty much points out what I'm trying to do. I have here two .CSV files that includes the usernames of a group and the other an OU. I need to compare the userlist of the group and the OU then proceed with deleting the duplicates from the group in AD.

I've been googling around, and have found a few leads, but me being a new Powersheller I have not been able to combine what I've found into a working command that does what I want it to.

Here is the format of the .CSV files that I want to be compared. Samaccountname (the header) should not be compared.

"samaccountname"
"tb2"
"tb3"
"tb4"
ShadowSF96
$Group = import-csv -path C:\Output\Test.csv
$OU = import-csv -path C:\Output\DomainUsers.csv
Compare-Object $Group $OU -property samaccountname -IncludeEqual | where-object {$_.SideIndicator -eq "=="} | Export-csv C:\Output\Difference.csv –NoTypeInformation

is the code I was looking for.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Trying to compare two csv files and write differences as output

From Dev

Compare two files and output match

From Dev

Compare two CSV files in Python

From Dev

How to compare two directories and delete duplicate files

From Dev

Compare and rename duplicate files between two folders

From Dev

Python difflib to compare two csv files and highlight the world level differences in HTML output

From Dev

Bash: compare two files and change the output

From Dev

Compare string in two files And Merge its Output

From Dev

Compare 4 columns in two files; and output the line for unique combination (from first file) and line for duplicate combination (from second file)

From Dev

Unix Compare Two CSV files using comm

From Dev

How to compare two csv files in windows

From Dev

Compare two CSV files and look for matches Python

From Dev

Compare Two CSV Files and Fetch Data

From Dev

How to compare two csv files by 2 columns?

From Dev

two .csv files compare using awk

From Dev

Compare two csv files to ouput the matches Python

From Dev

How to use Java to compare two csv files?

From Dev

Compare two different csv files & send email

From Dev

How to compare a specific column of two csv files?

From Java

Compare 2 different csv files and output all the changes into a new csv

From Dev

compare two column of two different CSV file & merge the output

From Dev

Python : Compare CSV files and save the difference with first row(Column Names)

From Dev

Compare names of files in two directories in command-line

From Dev

Compare two CSV files and update prices on the main CSV

From Java

How to compare 2 different csv files and output the differences

From Dev

compare 2 csv files and output only difference into variable

From Dev

Compare two folders and output missing files in both folders

From Dev

How to compare the output of the "head" command applied to two different files?

From Dev

python compare two texts files en print the output to another file

Related Related

  1. 1

    Trying to compare two csv files and write differences as output

  2. 2

    Compare two files and output match

  3. 3

    Compare two CSV files in Python

  4. 4

    How to compare two directories and delete duplicate files

  5. 5

    Compare and rename duplicate files between two folders

  6. 6

    Python difflib to compare two csv files and highlight the world level differences in HTML output

  7. 7

    Bash: compare two files and change the output

  8. 8

    Compare string in two files And Merge its Output

  9. 9

    Compare 4 columns in two files; and output the line for unique combination (from first file) and line for duplicate combination (from second file)

  10. 10

    Unix Compare Two CSV files using comm

  11. 11

    How to compare two csv files in windows

  12. 12

    Compare two CSV files and look for matches Python

  13. 13

    Compare Two CSV Files and Fetch Data

  14. 14

    How to compare two csv files by 2 columns?

  15. 15

    two .csv files compare using awk

  16. 16

    Compare two csv files to ouput the matches Python

  17. 17

    How to use Java to compare two csv files?

  18. 18

    Compare two different csv files & send email

  19. 19

    How to compare a specific column of two csv files?

  20. 20

    Compare 2 different csv files and output all the changes into a new csv

  21. 21

    compare two column of two different CSV file & merge the output

  22. 22

    Python : Compare CSV files and save the difference with first row(Column Names)

  23. 23

    Compare names of files in two directories in command-line

  24. 24

    Compare two CSV files and update prices on the main CSV

  25. 25

    How to compare 2 different csv files and output the differences

  26. 26

    compare 2 csv files and output only difference into variable

  27. 27

    Compare two folders and output missing files in both folders

  28. 28

    How to compare the output of the "head" command applied to two different files?

  29. 29

    python compare two texts files en print the output to another file

HotTag

Archive