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
0 answers

script to match software Powershell

Write-Host "Missing Software listed below..." -ForegroundColor Red if ($Zbook){ Compare-Object -ReferenceObject $SLZ -DifferenceObject $SLAcutal -Property DisplayName -PassThru | Where-Object{$_.SideIndicator -eq '<='} | …
iceman
  • 304
  • 1
  • 10
0
votes
3 answers

Loop Over Array of Objects and Combine them if they have similar keys

I am trying to iterate over an array that's similar to the below structure, and for each object that has the same id, I want them combined into a single object but with an array of all the 'names' associated with that id. My Array is pre-sorted by…
MattMcCode
  • 187
  • 4
  • 18
0
votes
1 answer

scriptblock returning object for compare-object

I'm writing a script to compare 2 samba locations via compare object. To speed things up i would like to give each location via a thread to a scriptblock where i let the object get made. After that i'd like the output from the scriptblock as an…
Michael
  • 57
  • 1
  • 11
0
votes
0 answers

Compare-Object Pass Into Get-ADUser To Get DisplayName

Good day. What I am trying to accomplish is showing the DisplayName as well as the Name but the only thing I can get to show with Compare-Object is Name so I am trying to pass the output from Compare-Object into Get-ADUser to get more user…
0
votes
2 answers

Compare outputs of two powershell scripts for AD computers

I have two PS scripts, one reads from a list of computers on Sharepoint and outputs the results and the other outputs a list of computers from Active Directory. What I need to do is somehow compare both of these lists to see: a) If list A has…
0
votes
1 answer

powershell compare-object output issue

I'm comparing two lengthy text files together by running the script below and writing results into text file. Instead of expected standard compare-object output I get a part of it and everything else gets trimmed (due to maximum characters limit or…
0
votes
1 answer

How can I perform arithmetic to find differences of values in two CSVs?

I'm able to diff contents ("cells") of two CSVs and get output of the highest value using the following function: Compare-Object $oldfile $latestfile -Property "UsedSize" -PassThru | select-Object "VolumeName", "UsedSize" | export-csv…
brandeded
  • 2,080
  • 6
  • 25
  • 52
0
votes
1 answer

Compare-Object remove parts of the resault

I have code Compare-Object $str $str1 | foreach InputObject | ft -auto | out-file "$resault" -width 5000 and I get somthing that looks like this \\Server\path\path\Config.Current.Running.rt-1.ci.cou.txt and i want only some part of it =…
0
votes
2 answers

Behaviour of PowerShell's -eq vs compare-object

Why does Compare-Object work as expected where -EQ fails to accurately compare arrays of strings? I had a PowerShell script which was populating an array of strings and was using the -EQ operator to test against the expected values - this was always…
Gene Lowy
  • 15
  • 5
0
votes
0 answers

Powershell: Compare-Object Issue

I try to compare two Arrays of user accounts and I'd like to find the unique accounts. Array number one contains following data: PS C:\Users\admin...\Desktop> $ExcludedUsers Name …
Alex O.
  • 1
  • 1
0
votes
1 answer

compare-object doesn't give any output

i run $serv1=gwmi -Namespace Root\cimv2 -Class Win32_service i stop some services manually and then run $serv2=gwmi -Namespace Root\cimv2 -Class Win32_service and then i compare these 2 objects compare-object $serv1 $serv2 compare-object…
Bipul Kumar
  • 39
  • 1
  • 7
0
votes
1 answer

System Object Error when exporting results to CSV

I am trying to export my results from a compare-object into a csv but I get an error When I export it. It looks ok when I just call it in excel. My guess is whenever there is a output of more than one value the error is placed instead of the…
ShanayL
  • 1,217
  • 2
  • 14
  • 29
0
votes
1 answer

Send object in function & comparison them to coincidence with other objects

I want to send some object to function for check it and set him some data. For example: i have 4 properties (with int type) of self class (inherit from NSObject class). And i want to change their data in one function. I must send dress of this…
0
votes
1 answer

compare-object in powershell, dosen't give any result

I have two arrays and I'm trying to compare them using compare-object. Aim here is to get the items that aren't in common. I collected the data in to two arrays $result1 and $result2 $result1 customersourceid ---------------- …
0
votes
0 answers

Powershell Compare-Object and getting the Differences into a File

I'm really new to PS and have been cracking my head on a particular problem. I'm trying to get the differences between what is in AD and what SCOM is monitoring already. Based on that I'll run a discovery or push out a look for certain services and…