Windows Thread, Script to add a group to a group in Technical; I want to put on a timer the adding of a group to a group in active directory. Easy i ...
8th December 2008, 12:56 PM #1
Script to add a group to a group
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?
IDG Tech News
8th December 2008, 01:15 PM #2
8th December 2008, 01:37 PM #3
- Rep Power
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...
8th December 2008, 01:39 PM #4
We use file permissions to allow access to a specific area on the local hard disk. We want to timer this by adding "Domain Users" to the group which has access to the folder.
Originally Posted by Lithium
8th December 2008, 02:09 PM #5
@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!)
net group <group with access> <username> /add /domain
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)
net group <group with access> <username> /delete /domain
8th December 2008, 02:18 PM #6
8th December 2008, 02:28 PM #7
- Rep Power
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)
8th December 2008, 10:36 PM #8
- Rep Power
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"
Thanks to Jonesminor from:
Quackers (9th December 2008)
9th December 2008, 11:27 AM #9
Thanks, DS MOD is doing the trick great!
Last Post: 27th January 2011, 01:06 PM
By goodhead in forum Windows
Last Post: 4th December 2008, 07:32 PM
By box_l in forum Scripts
Last Post: 4th June 2008, 09:34 PM
By ctote in forum Windows
Last Post: 18th April 2008, 08:49 AM
By CM786 in forum Windows
Last Post: 11th July 2006, 08:37 PM
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)