locked
powershell scripting RRS feed

  • Question

  • I have generated all the AD users in .csv1 file and i also got all the Prod Ad users in .csv2 file.  So there are some users in .csv1 file who are not in .csv2 file. So how can i compare the two files and how we can generate other .csv file for those who are not in .csv2file??? please help me out
    • Moved by Bill_Stewart Wednesday, September 13, 2017 10:16 PM Unanswerable drive-by question
    Saturday, August 12, 2017 2:31 PM

All replies

  • Here is a starter:

    $csv1 | where{ $_.user -notin ($csv2.user) } | ForEach{ $csv2+=$_}

    Of course you will have to apply your specifics to this as we cannot see your system.


    \_(ツ)_/


    • Edited by jrv Saturday, August 12, 2017 2:45 PM
    Saturday, August 12, 2017 2:45 PM
  • Get-Help Compare-Object -Full
    Saturday, August 12, 2017 2:49 PM
  • Here is another way to merge  two CSV files and return all unique records.

    $csv3 = $csv1+=$csv2 | select * -Unique


    \_(ツ)_/

    Saturday, August 12, 2017 2:51 PM
  • where does csv3 file appears?
    Saturday, August 12, 2017 3:36 PM
  • It is the result you asked for.

    \_(ツ)_/

    Saturday, August 12, 2017 4:29 PM