This looks good on paper but outputs incorrectly

Welcome Forums General PowerShell Q&A This looks good on paper but outputs incorrectly

Viewing 5 reply threads
  • Author
    Posts
    • #270598
      Participant
      Topics: 138
      Replies: 287
      Points: 449
      Rank: Contributor

      I was trying to query for a few attributes of a User that exists in multiple domains and knew something was up when the same values cam back for i.e. UPN (which should be different)

      What am I missing?

      My variables are correctly enumerating.

      Thanks

    • #270616
      Senior Moderator
      Topics: 9
      Replies: 1422
      Points: 5,289
      Helping Hand
      Rank: Community MVP

      Not clear on the issue you are facing, are you getting any error ?
      You are just iterating for each $dcs but not telling Get-ADUser about the DC info using -Server parameter.

      • This reply was modified 3 weeks, 1 day ago by kvprasoon. Reason: Post correction
    • #270733
      Participant
      Topics: 138
      Replies: 287
      Points: 449
      Rank: Contributor

      Apologies for that. I get output but for each domain (count = 4) I get the same exact data from just 1. I want to query for the one User in each of the returned Domains (from each of the respective Domains’ DCs).

    • #270739
      Participant
      Topics: 0
      Replies: 1
      Points: 10
      Rank: Member

      You just need to add the -Server parameter to Get-AdUser within your scriptblock on line 5. That Foreach construct runs the same command over and over with out the variable $dc in the scriptblock.

       

    • #270757
      Participant
      Topics: 138
      Replies: 287
      Points: 449
      Rank: Contributor

      Thank guys, working now…..(great to see your newest avatar, kvprasoon)

      • This reply was modified 2 weeks, 2 days ago by Jeff Taylor.
    • #270898
      Senior Moderator
      Topics: 9
      Replies: 1422
      Points: 5,289
      Helping Hand
      Rank: Community MVP

      @jeff-taylor 🙂

      Hope your issue got addressed.

Viewing 5 reply threads
  • You must be logged in to reply to this topic.