3

Is there a way to update the "Managed By" field for every group in Active Directory? I would also need to check "Manager can update membership list" also.

jscott
  • 24,204
  • 8
  • 77
  • 99
Patrick
  • 33
  • 1
  • 3

3 Answers3

8

This can be done through PowerShell

$DNOfManager=dsquery user -o dn -name "Testing Tester"
$GroupList=dsquery group DC=ad,dc=example,dc=local -limit 600 
Foreach ($group in $grouplist) {
    set-adgroup -Identity $Group -ManagedBy $DNOfManager
    add-adpermission -Identity $Group -user $DNOfManager -AccessRights ReadProperty, WriteProperty -Properties 'Member'
}

This is undebugged, but should get you most of the way there. What it does:

  1. Uses dsquery to grab the Distinguished Name of the user with the full-name of "Testing Tester".
  2. Uses dsquery to fetch a list of candidate groups, and passes that to a variable as a list.
  3. Iterate through the list. On each list-member:
    1. Assign the ManagedBy attribute
    2. Assign the rights to update the Member attribute

So long as $DNOfManager is set right, this should set all groups in the domain to be managed by that one manager. ALL of them. Make sure the query in step one is defined right and doesn't pick up groups you don't want (Domain Admins?).

sysadmin1138
  • 131,083
  • 18
  • 173
  • 296
  • Sorry, I'm new to PowerShell. Say I wanted the manged by person to be test test@domain.com. Where would I put that. – Patrick May 25 '11 at 18:37
  • 3
    +1 - That's a clear win for PowerShell over any other method (including Joe Richards' ADMOD, which is what I was starting to write a post about). I should try to get over my dislike of PowerShell a little harder I suspect. – Evan Anderson May 25 '11 at 18:37
  • @Patrick I modified the script to make it more clear. – sysadmin1138 May 25 '11 at 19:37
1

Looks like Active Directory is scriptable...link

You could do some research there and figure out how to script modifications. I would definitely recommend creating yourself a sandbox so you're not experimenting with scripts against your live Active Directory setup, though. I've learned this the hard way before; if you're experimenting with new stuff, don't do it with any data or setup you would be sad to see blown away.

Mr. Jefferson
  • 697
  • 2
  • 11
  • 25
-1

Unfortunately there is no "bulk" way to select 'managed by' for all groups within a directory. You will have to select each individual group to change the managed by field.

My apologies gentlemen. I jumped to conclusions based on the interface of active directory alone. The idea of scripting escaped me. I also apologize for the use of the word "bulk." Quite frankly the site is new to me so I apologize for the lack and consideration of expertise on the topic expressed.

jscott
  • 24,204
  • 8
  • 77
  • 99
GMitch
  • 500
  • 3
  • 12