How to add Domain Users to Group in Active Directory through vbscript

In order to add domain user to domain group first get the group object then get the domain user from active directory, then add user's ADsPath to group as shown in below sample code.
 
Set objGroup = GetObject("LDAP://CN=TestGroup,OU=TestOU,DC=TEST,DC=com")
Set objUser = GetObject("LDAP://CN=TestUser,OU=TestOU,DC=TEST,DC=com")
objGroup.Add(objUser.ADsPath)
Wscript.echo "Successfully added user TestUser to TestGroup"

Comments

Popular posts from this blog

How to flash CWM Recovery to Samsung Galaxy SL( GT-I9003) using Odin

How to boot Samsung Galaxy SL( GT-I9003) in recovery mode

Exception handling with RestTemplate