Questions tagged [compareobject]

Usually refers to object comparison in object oriented languages.

Typical cases compare:

  • Ojects values.
  • Object references.
  • Object types.
99 questions
0
votes
2 answers

Comparing values with Compare-Object

Have a bunch of values from csv file, with column looking like this: shouston cgonzalez bbrown hlader kpesavento jbloom polson bcharlow bcharlow bkalt Need to find duplicates and modify them. # Grab CSV file $inputFile = Import-Csv -Path…
Art
  • 29
  • 7
0
votes
0 answers

How to combine multiple CSV files by the matching contents

I have two csv. first one is for PC info.(pcinfo.csv) R1234 has two PCs Second one is for User-mail info(mail.csv) R9876 has no mail address I want to make master CSV based on User ID like as below; $doc1 = import-csv c:\pcinfo.csv $doc2 =…
yisjin86
  • 3
  • 1
0
votes
0 answers

PowerShell comparing multiple files

In PowerShell there is a cmdlet Compare-Object for comparing two objects, but is there a way to compare 3 or more objects?
0
votes
1 answer

filter and sum data from 2 array of objects to a new array in JS

I have 2 arrays of JavaScript objects: const typeCrop = [ { id: 1, name: 'apple' }, { id: 2, name: 'pineapple' }, { id: 3, name: 'orange' }, { id: 4, name: 'berry' }, ] const lands = [ { landOwnerId: 6, landId: 1, landTypeID: 1,…
0
votes
2 answers

Compare Object and exporting an Excel Spreadsheet with only users that are in both AD groups

I'm wanting this script to export an Excel spreadsheet with only the users that are in both AD groups. $members1 = (Get-ADGroup 'Imprivata1' -Properties Member).Member $members2 = (Get-ADGroup 'Imprivata2' -Properties Member).Member Compare-Object…
0
votes
1 answer

How to compare two different objects in Typescript

I know it's bad form to answer my own question. Hope to save you hours. There were others that ask this Typescript question and the moderators closed them pointing to rather large threads (4+ pages) of javascript answers that didn't help me and…
AppDreamer
  • 1,266
  • 3
  • 16
  • 34
0
votes
1 answer

Compare-Object where ReferenceObject from flat file doesnt exist in DifferenceObject only

I am looking to sanity check a flat csv file from Workday prior to import into MIM. The file is dumped in a path on the server every 90 minutes. Before importing the file into MIM I would like to compare the most recent download to the last import.…
LEnc95
  • 58
  • 2
  • 10
0
votes
0 answers

pester test with Compare-Object fails in azure pipeline

I am comparing two files which looks exactly alike, and when I test locally there is no problem, but when i run the test in my azure pipeline, the test fails and says it does not look alike. I have no idea why or what to do for debugging? …
Nadia Hansen
  • 697
  • 2
  • 6
  • 16
0
votes
0 answers

Powershell Compare-Object Doesn't work properly

I have to compare emails from PST against living Mailbox. For that i wrote an entire script-program, using Outlook.Application and Namespace MAPI, to get objects and access their attributes. To run all of it, it's takes time. Playing with object and…
YosiCohen
  • 1
  • 1
0
votes
2 answers

Comparing Desktop and documents with their backup and produce an output.txt file that highlights the different folders and files between them

can someone please help me. Still new to powershell, I am comparing my documents and desktop mirror to check my backup solutions using several different codes. The one below is meant to check both the documents/desktop with its mirror folders and…
Yaz
  • 23
  • 6
0
votes
2 answers

Powershell - Comparing get-variable outputs and displaying if any values change

Hi I hope someone can point me in the correct direction here. I am trying to create some PS 5.1 code that can compare get-variable output at the start of a script with get-variable output generated when there is a error. I would like to display…
Pete
  • 91
  • 5
0
votes
1 answer

Powershell Compare-Object Output Separate Files for each SideIndicator

(This is probably something rather simple I'm missing; but I can't seem to figure it out and haven't found any answers in search) I need to compare two CSV files with the same columns and output the row differences as follows (final output in…
DickieD
  • 3
  • 3
0
votes
0 answers

PowerShell - Compare two files not showing correct data

I am trying to compare to CSV files with the exact same headings (parent ID, Folder Name, Folder Code 1) However, it's not showing all the data. For example, I know one class is Called "7 Food and Hospitality 2 2021" but the output doesn't show this…
Fallen Soul
  • 27
  • 1
  • 7
0
votes
1 answer

Compare objects and create a new one similar to one of them

I want to compare 2 objects and create a new one with the values of the second if its values are not null. Otherwise the values of the first one should be copied to the object created. My problem is that I don't know how to set the value which I…
porthfind
  • 1,581
  • 3
  • 17
  • 30
0
votes
1 answer

Finding differences in .JSON files using Powershell Compare-Object, problems with square bracket values

I am trying to compare two .json files using # Compare two files $BLF = (Get-Content -Path C:\Users\...\Documents\Android1.json) $CLF = (Get-Content -Path C:\Users\...\Documents\Android2.json) $aUnsorted = Compare-Object -ReferenceObject $BLF…