Welcome Forums General PowerShell Q&A get members of group and update company field

Viewing 2 reply threads
  • Author
    • #189106
      Topics: 1
      Replies: 0
      Points: 0
      Rank: Member

      this should be simple…but i’m having problems getting it done. I could do this if i exported to a csv and then imported that but i’d like to do this on the “fly” …plus i’d learn something new!

      basically trying to get members of an ad group and update the company name field of each member, i’ve tried different ways of looping but cant get it to work.  thanks for the help

      here’s my last attempy

      $users = Get-ADGroupMember -Identity testgroup -Recursive
      where {$_.enabled -eq $true} | `
      Set-ADUser -Identity $users.SamAccountName -Company "test company"
    • #189121
      Topics: 2
      Replies: 1736
      Points: 3,552
      Helping Hand
      Rank: Community Hero

      Is it really necessary to crosspost in more than one forum at the same time without even waiting some minutes for an answer?


      You could at least post a link to the crossposts to avoid people willing to help you spend some effort for nothing.

    • #189205
      Topics: 17
      Replies: 16
      Points: 45
      Rank: Member

      Get-ADGroupMember -Identity testgroup | %{Get-Aduser $_ | where {$_.enabled -eq $true} | %{Set-Aduser $_ -Company “Test Co.”}

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