Demonstration script that: 1) creates a new Active Directory organizational unit; 2) creates a new user account and new security group; and, 3) adds the new user as a member of that security group.
Set objDomain = GetObject("LDAP://dc=fabrikam,dc=com")Set objOU = objDomain.Create("organizationalUnit", "ou=Management")objOU.SetInfoSet objOU = GetObject("LDAP://OU=Management,dc=fabrikam,dc=com")Set objUser = objOU.Create("User", "cn= AckermanPilar")objUser.Put "sAMAccountName", "AckermanPila"objUser.SetInfoSet objOU = GetObject("LDAP://OU=Management,dc=fabrikam,dc=com")Set objGroup = objOU.Create("Group", "cn=atl-users")objGroup.Put "sAMAccountName", "atl-users"objGroup.SetInfoobjGroup.Add objUser.ADSPath
This is a VB Script, this can be used by saving the file in .vbs file