'************************************************** ' ' This script adds a user to the passed in OU ' To run: cscript adduser_adam.vbs ADsPath UserName ' Examples: cscript adduser_adam.vbs LDAP://localhost:389/ou=testou,c=us testuser ' '************************************************** set Args = Wscript.Arguments OUName = Args(0) usrName = Args(1) ' If the application NC 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" 'Bind to Root Set ou = GetObject( OUName) set usr = ou.Create("user", "cn=" & usrName) usr.Put "displayName", usrName usr.Put "userPrincipalName", usrName & "@adamtest.com" usr.SetInfo wscript.echo " User " & usrName & " was created successfully"