I want to put on a timer the adding of a group to a group in active directory. Easy i thought, i'll use the NET GROUP command. In a batch file,
so i try NET GROUP "GROUP 1" "GROUP 2" / ADD
It says no such user as it thinks i'm trying to add a user to a group.
How can i achive this with a script?
Why would you want to put on a timer, the adding of a group to a group?
Active Directory groups automagically update themselves when child groups are updated...
@ful56_uk should have pointed you in the right direction; if not then give me a shout and I'll dig out some more sample code.
You can't do it with the "net group" command because it uses the API from Windows NT days (probably LAN Manager days!) which didn't support nested groups. You have to use the ADSI interface and then it will work well.
If you can't get that to work and you need it in a hurry then take the list of usernames and make a long list of:
(create them in Excel!)Code:net group
followed by a matching list of:
(remember that even if you don't have the username list that net group will give you that list)Code:net group
Somewhere I read in a different topic that other people do the same sort of thing... but they add and remove the group from the security permissions and schedule that to run at two times (add the group and remove the group)
dsmod group with -addmbr and -rmmbr
dsmod group "CN=Group, OU=GroupLivesHere, OU=ParentOU, DC=your, DC=domainname" -addmbr "CN=Domain Users, CN=Users, DC=your, DC=domainname"
Quackers (9th December 2008)
Thanks, DS MOD is doing the trick great!
There are currently 1 users browsing this thread. (0 members and 1 guests)