Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - add a global group to a domain local group

Reply
 
Old 08-11-2009   #1 (permalink)
Mick


 
 

add a global group to a domain local group

Hello ng

I will add a global group to a domain local group with a vb-script.

This code doesn't run:
Const ADS_PROPERTY_APPEND = 3

Set objGroup = GetObject ("LDAP://CN=DL Anarbeitung -
RW,OU=GroupRessource,OU=Groups,OU=ab,DC=xy,DC=local")
objGroup.PutEx ADS_PROPERTY_APPEND, "member", _
Array ("LDAP://CN=GG
Anarbeitung -RW,OU=GroupGlobal,OU=Groups,OU=ab,DC=xy,DC=local")
objGroup.SetInfo

The error is:
- The server is unwilling to process the request! -> at this command:
objGroup.SetInfo



Thanks
miller



My System SpecsSystem Spec
Old 08-11-2009   #2 (permalink)
Richard Mueller [MVP]


 
 

Re: add a global group to a domain local group


"Mick" <mw@xxxxxx> wrote in message
news:A53880F1-2427-4B3F-89C1-F4E11C4B02AE@xxxxxx
Quote:

> Hello ng
>
> I will add a global group to a domain local group with a vb-script.
>
> This code doesn't run:
> Const ADS_PROPERTY_APPEND = 3
>
> Set objGroup = GetObject ("LDAP://CN=DL Anarbeitung -
> RW,OU=GroupRessource,OU=Groups,OU=ab,DC=xy,DC=local")
> objGroup.PutEx ADS_PROPERTY_APPEND, "member", _
> Array ("LDAP://CN=GG
> Anarbeitung -RW,OU=GroupGlobal,OU=Groups,OU=ab,DC=xy,DC=local")
> objGroup.SetInfo
>
> The error is:
> - The server is unwilling to process the request! -> at this command:
> objGroup.SetInfo
>
>
>
> Thanks
> miller
>
The member attribute of group objects is linked with the memberOf attribute
of user/group/computer objects (the members). You should not modify these
attributes directly. You can use the Add method of the group object to add
members (and the Remove method to remove members and the IsMember method to
check membership). You pass the AdsPath of the prospective member to the
methods. When adding a member, I like to bind to the member object, so I'm
sure it exists and I have the correct AdsPath. For example (watch line
wrapping):
======
Set objGroup = GetObject ("LDAP://CN=DL Anarbeitung -
RW,OU=GroupRessource,OU=Groups,OU=ab,DC=xy,DC=local")
Set objMember = GetObject("LDAP://CN=GG
Anarbeitung -RW,OU=GroupGlobal,OU=Groups,OU=ab,DC=xy,DC=local")
' Check if already a member.
If (objGroup.IsMember(objMember.AdsPath) = False) Then
' Add member to the group.
objGroup.Add(objMember.AdsPath)
End If
======
I believe it's possible to manipulate the linked attribute memberOf,
although I don't recommend it. You cannot manipulate the backlinked
attribute member directly. The methods exposed by the IADsGroup interface
were designed for the purpose.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


My System SpecsSystem Spec
Old 08-12-2009   #3 (permalink)
Mick


 
 

Re: add a global group to a domain local group

"Richard Mueller [MVP]" <rlmueller-nospam@xxxxxx> schrieb im
Newsbeitrag news:OcA788oGKHA.4956@xxxxxx
Quote:

> ======
> Set objGroup = GetObject ("LDAP://CN=DL Anarbeitung -
> RW,OU=GroupRessource,OU=Groups,OU=ab,DC=xy,DC=local")
> Set objMember = GetObject("LDAP://CN=GG
> Anarbeitung -RW,OU=GroupGlobal,OU=Groups,OU=ab,DC=xy,DC=local")
> ' Check if already a member.
> If (objGroup.IsMember(objMember.AdsPath) = False) Then
> ' Add member to the group.
> objGroup.Add(objMember.AdsPath)
> End If
> ======

hello Richard

It runs perfect!

thanks

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
"add domain group to local group" stopped working VB Script
add user to group /group scope - Global /Group type - Security PowerShell
Difference between a domain group and a local group VB Script
Add domain group to local group question VB Script
adding a domain user to the local group PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46