
|
email this FAQ to a colleague
Q:
How do I add a user to a group using ADSI?
A:
Here is some code that uses ADSI to add a user to a group.
strDomain="Workgroup"
strUser="jdoe"
strGroupName ="Administrators"
Set oDomain = GetObject("WinNT://" & strDomain)
Set oGroup = oDomain.GetObject("Group", strGroupName)
oGroup.Add ("WinNT://" & strDomain & "/" & strUser)
Set oDomain=Nothing
Set oGroup=Nothing
- Wayne Berry
|