+ Post New Thread
Results 1 to 9 of 9
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 ...
  1. #1
    Quackers's Avatar
    Join Date
    Jan 2006
    Posts
    1,347
    Thank Post
    40
    Thanked 145 Times in 120 Posts
    Rep Power
    54

    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?

  2. #2
    ful56_uk's Avatar
    Join Date
    Mar 2008
    Location
    Essex
    Posts
    562
    Thank Post
    105
    Thanked 25 Times in 22 Posts
    Rep Power
    19

  3. #3

    Join Date
    Jul 2007
    Location
    Devon
    Posts
    233
    Thank Post
    8
    Thanked 9 Times in 8 Posts
    Rep Power
    16
    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...

  4. #4
    Quackers's Avatar
    Join Date
    Jan 2006
    Posts
    1,347
    Thank Post
    40
    Thanked 145 Times in 120 Posts
    Rep Power
    54
    Quote Originally Posted by Lithium View Post
    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...
    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.

  5. #5

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,156
    Thank Post
    116
    Thanked 529 Times in 452 Posts
    Blog Entries
    2
    Rep Power
    124
    @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:

    Code:
    net group <group with access> <username> /add /domain
    (create them in Excel!)

    followed by a matching list of:

    Code:
    net group <group with access> <username> /delete /domain
    (remember that even if you don't have the username list that net group will give you that list)

  6. #6
    Quackers's Avatar
    Join Date
    Jan 2006
    Posts
    1,347
    Thank Post
    40
    Thanked 145 Times in 120 Posts
    Rep Power
    54
    Quote Originally Posted by srochford View Post
    @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.
    The link from ful56_uk is making my eyes bleed . I've had a go, but it just errors when i alter things in the example code. Cannot belive how difficult things are to do with VBS, cannot find Group to Group examples anywhere...

  7. #7

    Join Date
    Jul 2007
    Location
    Devon
    Posts
    233
    Thank Post
    8
    Thanked 9 Times in 8 Posts
    Rep Power
    16
    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)

  8. #8

    Join Date
    Oct 2006
    Posts
    23
    Thank Post
    1
    Thanked 6 Times in 5 Posts
    Rep Power
    18
    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"

    --

  9. Thanks to Jonesminor from:

    Quackers (9th December 2008)

  10. #9
    Quackers's Avatar
    Join Date
    Jan 2006
    Posts
    1,347
    Thank Post
    40
    Thanked 145 Times in 120 Posts
    Rep Power
    54
    Thanks, DS MOD is doing the trick great!

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 2
    Last Post: 27th January 2011, 12:06 PM
  2. how can i bulk add users to a an AD group
    By goodhead in forum Windows
    Replies: 5
    Last Post: 4th December 2008, 06:32 PM
  3. Script to add computers to AD like RIS
    By box_l in forum Scripts
    Replies: 2
    Last Post: 4th June 2008, 08:34 PM
  4. Replies: 19
    Last Post: 18th April 2008, 07:49 AM
  5. Replies: 21
    Last Post: 11th July 2006, 07:37 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •