i am quite new to python ...
currently i am a student learning for mu mcitp exams..

i made a small script ,, for active directory using python

all the script does is basicly explor the AD for a number of tasks ..

* 1 .Find a user (quick method)
* 2 .Find a computer (quick method)
* 3 .List all users
* 4 .List users in an OU
* 5 .List all groups
* 6 .Show the members of a group
* 7 .Show the types of a group
* 8 .List the groups a user is in

i have used the AD moudle for this script ..

my question is this i have the follwing code :

# find user (
elif choice == "1":
import active_directory
user = active_directory.find_user ("shay")
print user

how can i make the entry for the "user" (in this case "shay"
shift according to raw input from the user

i need the ability to replace the name
how can i accomplise this ?

Recommended Answers

All 2 Replies

# find user (
elif choice == "1":
import active_directory
user_name = raw_input('Enter user name: ")
user = active_directory.find_user (user_name)
print user

You might also want to do some input checking and/or check that the find_user function returns a valid user.

thank you adam worked !

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.