Compare-Object results were empty

Welcome Forums General PowerShell Q&A Compare-Object results were empty

Viewing 2 reply threads
  • Author
    Posts
    • #257843
      Participant
      Topics: 129
      Replies: 277
      Points: 365
      Rank: Contributor

      I was trying to compare group memberships using this one-liner:

      ..and it came up empty (without error)

      so then I tried this:

      …and the results are still empty. (There are differences)

      Why no diff?

    • #257864
      Participant
      Topics: 16
      Replies: 1794
      Points: 3,300
      Helping Hand
      Rank: Community Hero

      There is no Compare-Object in the examples you posted. In the first example, you need to reference the Property as it’s an object:

      In the second example, you are using making the items an array, so it would be compared without a property reference:

    • #257930
      Participant
      Topics: 129
      Replies: 277
      Points: 365
      Rank: Contributor

      I thought I could use Compare-Object against strings based on the Help -examples.

      I see I have the type TypeName: Microsoft.ActiveDirectory.Management.ADUser in my Variables, so there are too many properties.

      How would I most efficiently point to¬†one of those properties then, for a compare ? I don’t want to have to list out the groups in memberOf manually. I want PowerShell to do the work.

      • This reply was modified 1 month ago by Jeff Taylor. Reason: clarification
Viewing 2 reply threads
  • You must be logged in to reply to this topic.