Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8551041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:06:18+00:00 2026-06-11T14:06:18+00:00

I have two System.Data.DataSet objects that I wish to compare using the Compare-Object Cmdlet.

  • 0

I have two System.Data.DataSet objects that I wish to compare using the Compare-Object Cmdlet. I wish to output a dataset with the columns of the original datasets but with only the differences and an additional column with the SideIndicator values calculated in the Compare-Object cmdlet.

Assuming I have these two CSV’s:

#C:\test.csv
"firstName","lastName"
"Bruce","Wayne"
"Clark","Kent"

#C:\test2.csv
"firstName","lastName"
"Peter","Parker"
"Clark","Kent"
"Jean","Grey"

I would like to use the results of:

compare-object (Get-Content C:\test.csv) (Get-Content C:\test2.csv)

to populate a dataset formatted as follows:

#desiredResult
"firstName","lastName","SideIndicator"
"Peter","Parker","=>"
"Jean","Grey","=>"
"Bruce","Wayne","<="

Thanks,
Zach

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T14:06:20+00:00Added an answer on June 11, 2026 at 2:06 pm

    This should give $output the value you are looking for.

    $output = Compare-Object $(Import-Csv c:\test.csv) $(Import-Csv c:\test2.csv) -Property FirstName, Lastname
    

    When you use Get-Content of a file, it puts each line as an object of the array. This treats the firstname and lastname as a single line, which exists in both arrays. Therefore, it’s not returned with the compare-object since it is in both.

    When you use Import-Csv it takes the first row as headers, and makes them properties to the array. Each line after that is added to the property based on it’s location in the .csv. This means that compare-object can compare them with different arrays, and maintain the properties to an output.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two arrays of System.Data.DataRow objects which I want to compare. The rows
Lets say we have two objects o1 & o2 defined as System.Object, in my
Lets say that I have two strings: The System is in halt state. The
I have two separate applications (both part of the same system) that share a
I have two different-sized monitors, connected together using (I believe) TwinView. I tried System.out.println(Toolkit.getDefaultToolkit().getScreenSize());
I've got a bunch of strongly typed DataSet that each have two tables. One
In my system I have two different projects, one defining its interfaces and another
I have two types of users for my system, normal human users with a
I have two points in a cathesian 2D system, both give me the start
I have two Play framework web applications running on my system on ports 9001

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.