Use this tag for questions about the Python Active Directory module. For general questions about Active Directory on Windows, use the tag [active-directory] instead.
Questions tagged [pyad]
36 questions
3
votes
1 answer
pyad: Installs fine, but says it can't find adbase
This has me pretty confused. I've installed pyad using pip and everything seems fine:
C:\WINDOWS\system32>pip install pyad
Collecting pyad
Using cached pyad-0.5.16.tar.gz
Requirement already satisfied (use --upgrade to upgrade): setuptools in…

fny82
- 185
- 3
- 13
2
votes
1 answer
Python PyAD setting multiple workstations during creation of user
Trying to add multiple workstations using pyad. I am able to set a single workstation, but not multiple workstations.
from pyad import aduser
ou = pyad.adcontainer.ADContainer.from_dn(
"ou=someplace, DC=domain,…

George Nguyen
- 33
- 8
2
votes
1 answer
Python - pyad create user with a comma in their name
I'm trying to create a user using pyad, what I have working is:
ou = pyad.adcontainer.ADContainer.from_dn('OU=Employees,DC=lan,DC=company,DC=com')
name = ("doe john")
newUser = pyad.aduser.ADUser.create(name, ou,…

bogus
- 457
- 5
- 16
2
votes
1 answer
How to create a new user in Active directory using Python pyad module
I am trying to create 100 000 users in Active Directory with different attributes. I am trying this with pyad module as shown below:
from pyad import *
user = aduser.ADUser.from_cn("test")
pyad.set_defaults(ldap_server="blr.test.local",…

rcubefather
- 1,534
- 6
- 25
- 49
2
votes
1 answer
problems accessing object [] using python pyad
I'm having problems trying to access the active directory user attribute using pyad. Here is my code:
user = pyad.aduser.ADUser.from_cn("tuser")
print user.get_attribute(lastLogonTimestamp")
These are the printed…

PuN1sh3r
- 91
- 1
- 8
1
vote
1 answer
Change how PyAD searches for Users
I am working on creating a python script that can connect to AD and search for user attributes such as (name, email, location, email, extension). Currently I am searching users by CN to find their AD account. The problem I am running into is that…

DaHawg
- 73
- 5
1
vote
1 answer
Unable to contact Active Directory through pyad
I'm not able to connect to pyad module to create Active Directory objects. I'm getting an exception as shown below:
Traceback (most recent call last):
File "", line 1, in
File…

SP Satyanarayana
- 11
- 1
1
vote
1 answer
Last name update using pyad
Am trying to create users in active directory using pyad and it is successful. when i try to udpate last name of user, it is throwing "attribute error". I checked with attributes in AD and it is same what am using in program.
The code:
import…

Sheik Kalidh
- 33
- 1
- 8
1
vote
3 answers
pyad - Get username from email address
I am trying to get a list of usernames using a list of emails in pyad. I know I can get emails from the usernames:
user = aduser.ADUser.from_cn('username').mail
But I was wondering if there was a way to do the reverse.

userfriendly
- 363
- 1
- 4
- 12
1
vote
3 answers
Python using pyad to display attributes, not getting logonHours
I've been trying to get logonHours to display, while using the pyad in Python 3.7. When I go to display logonHours, as an output it gives me
memory at 0x0000000003049708 etc.
Not sure how to display that data. All other attributes displays…

George Nguyen
- 33
- 8
1
vote
1 answer
Error trying to use pyad to update user account
I'm trying to update a user attribute in Active Directory using pyad. This is my code
from pyad import *
pyad.set_defaults(ldap_server="server.domain.local",
username="admin",…

Ben Caldwell
- 23
- 6
1
vote
1 answer
Having trouble getting pyad to work
I had this working before. Now, after flatting and rebuilding machine, I can't seem to get pyad working.
My script uses adquery to get the members of a domain.
I've installed pyad and pywin32 with the correct versions. I am using Python 3.6.
I…

Chris Williams
- 47
- 1
- 6
1
vote
1 answer
PyAD AD Query check if user exists if not create it
I'm fairly new to Python and I am trying to Query an AD server and check to see if a User exists based on some attributes (username, firstName, lastName) and if that user exists query their groups to see if they are in a specific group and if not,…

user2019182
- 295
- 5
- 19
0
votes
0 answers
PyAD- Date based attributes Mostly return None
Copying from Github-
When I try to adquery or pull an attribute that has a date involved (such as lastLogon, lastLogoff, or even a log off method... the attribute always comes up None. However other attributes seem to work. What am I doing…

mansmokes
- 15
- 2
0
votes
0 answers
Renaming a user's CN with PYAD when it contains a comma
I'm able to rename a CN for a user when it doesn't have a comma, but some of our users were previously entered as "Lastname, Firstname" and none of those will work when attempting to rename them. I tried escaping the comma with a backslash per some…

elbow
- 1
- 1