hello all,
i need to write a script for windows server 2003 that will allow me to add new users to the Active Directory, but not conventionally, as i will soon explain.

This is a full command right now:

dsadd user "CN=ATEST001,OU=local-admins,DC=red,DC=qumranet,DC=com" -display "ATEST001 FAMILYNAME" -pwd 123456 -u RED\administrator -p 123456 -samid ATEST001 -memberof "CN=rdp-admin,OU=local-admins,DC=red,DC=qumranet,DC=com" -upn "ATEST001@red.qumranet.com" -disabled no -pwdneverexpires yes

Parameters that i want to be able to play with in the creation process are:

1. User - an admin or not? i want to give them descriptive name - for example, Axxxx would be an admin, Uxxxx would be a user.

2. Domain name - as you can see above, it is all for RED right now.

3. basic group membership. Right now, it's 'local-admins' (which may not be true for users!).

4. member of which groups: Above, it's rdp-admin. We may want to have others, or more than one.

5. how many users will be created each time i run the script.
any kind of help would be great.
thanks.

I don't know if this is the type of thing you have in mind, but let's take a simpler example: I want to allow the user to input a filepath and print the directory of that path.

import os

pathname = raw_input('Which path do you want to list? ')
os.system('dir %s' % pathname)
raw_input('press <Enter> to exit')

If I run this from the command line or by double-clicking (but not from IDLE), then I can get the usual dir output.

Your example is a bit longer, but it uses the same concepts in principle: raw_input or some other means to collect the parameters, %s to interpolate them into the command string, and os.system() to execute the command string.

Hope I'm on the right track,
Jeff

This article has been dead for over six months. Start a new discussion instead.