'************************************************** ' ' This script adds a user to the passed in group ' To run: cscript addusr2grp_adam.vbs ADsParentPath Usr Group ' Examples: cscript addusr2grp_adam.vbs LDAP://localhost:389/ou=testou,c=us testuser testGroup ' '************************************************** set Args = Wscript.Arguments ouName = Args(0) usrName = Args(1) grpName = Args(2) ' If the application OU DN is "ou=adamou,c=us" and the server is "adamhost" and the port is 389. Then the parameter ouName should be passed ' as follows: "LDAP://adamhost:389/ou=adamou,c=us" set ou = GetObject(ouName ) Set grp = ou.GetObject("group", "CN=" & grpName ) Set usr = ou.GetObject("user", "CN=" & usrName ) grp.Add usr.AdsPath wscript.echo "User " & usrName & " was successfully added to group " & grpName