jskfan
asked on
a SCRIPT to add group members to another group
I have created a new users group, and already have other users groups that have members inside.
I would like to have a script that adds the members of existing groups to the new group.
Thanks
I would like to have a script that adds the members of existing groups to the new group.
Thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I am running this script, but it gives me an error " the server is unwilling to process the request" line 7 char 1,
which is this line :
objNewGroup.SetInfo
Const ADS_GROUP_TYPE_GLOBAL_GROU P = &H2
Set objOU = GetObject("LDAP://OU=testo u, dc=training")
Set objOldGroup = GetObject("LDAP://CN=group test1, ou=testou, dc=training")
Set objNewGroup = objOU.Create("Group", "Finance Department")
objNewGroup.sAMAccountName = "financedept"
objNewGroup.groupType = ADS_GROUP_TYPE_GLOBAL_GROU P
objNewGroup.SetInfo
For Each objUser in objOldGroup.Member
objNewGroup.Add "LDAP://" & objUser
Next
which is this line :
objNewGroup.SetInfo
Const ADS_GROUP_TYPE_GLOBAL_GROU
Set objOU = GetObject("LDAP://OU=testo
Set objOldGroup = GetObject("LDAP://CN=group
Set objNewGroup = objOU.Create("Group", "Finance Department")
objNewGroup.sAMAccountName
objNewGroup.groupType = ADS_GROUP_TYPE_GLOBAL_GROU
objNewGroup.SetInfo
For Each objUser in objOldGroup.Member
objNewGroup.Add "LDAP://" & objUser
Next
ASKER
Any update guys?
hi,
Sorry for delay
the server is unwilling to process the request
solution:
http://computerperformance.co.uk/Logon/code/code_80072035.htm
Sorry for delay
the server is unwilling to process the request
solution:
http://computerperformance.co.uk/Logon/code/code_80072035.htm
ASKER
can you explain this please, what it does?
I am getting error "Network path not found"
set group = GetObject(adsPath)
this gives me error
strGroupName = trim(cstr(inputbox("enter domain/group...")))
If trim(strGroupName) = "" Then WScript.quit
adsPath = "WinNT://" & strGroupName & ",group"
set group = GetObject(adsPath)
set d = createobject("scripting.di
d(d.count) = ""
d(d.count) = group.adspath
d(d.count) = ""
For Each member in group.members
d(d.count) = member.adspath
Next 'Group
wscript.echo join(d.items,vbcrlf